Category: Tutorials

2 ways of printing an array in php

2 ways of printing an array in php

PHP provides two very useful functions that can be used to output a variable’s value recursively called print_r() and var_dump(). - Create An Array: $my_array = array("elem_1","elem_2","elem_3"); - Using Print_r() function: Print_r() can return its output as a string, as opposed to writing it to the scripts standard output print_r($my_array); // Output: // Array ( [...]
Back To Top