Echo or Print for php array

echo is used to output strings, but an array cannot be directly echoed. If you want to display the contents of an array, you can use print_r() or var_dump() for debugging purposes, or loop through the array to print each element.

        <?php
        $className = array('arnob', 'hasan', 23);

        print_r($className);
        ?>
    
Powered by Blogger.