Concept
How can you print the contents of a PHP array in a readable format?
ComputerScienceOne / Useful Functions
"For convenience and debugging, a special function, print_r() allows you to print the contents of an array in a human-readable format that resembles the key-value initialization syntax above. For example,\n\n$arr = array(\n\n\"foo\" => 5,\n\n4 => \"bar\",\n\n0 => 3.14,\n\n\"baz\" => \"ten\"\n\n);\n\nprint_r($arr);\n\nwould end up printing\n\nArray\n\n(\n\n[foo] => 5\n\n[4] => bar\n\n[0] => 3.14\n\n[baz] => ten\n\n)"
Related Ideas
- What PHP array concepts are listed in the index?ComputerScienceOne · Index
- How can you iterate over indexed and associative arrays in PHP?ComputerScienceOne · Iteration
- How do you create and index arrays in PHP?ComputerScienceOne · Creating Arrays
- How can you extract array keys and values and compare arrays in PHP?ComputerScienceOne · Iteration
- How does PHP support and create multidimensional arrays?ComputerScienceOne · Multidimensional Arrays