In PHP, what is function for outputting the contents of an array at runtime?
- print()
- print_array()
- print_r()
- echo
EXPLANATION
The PHP function print_r() is responsible for outputting the contents of an array at runtime. It is often used for debugging an array during development.
Example:
<?php
$MyArray = array("apple", "orange", "banana");
print_r($MyArray);
/*-------------------------------------------*/
The above would be outputted as:
Array([1]=>apple,[2]=>orange,[3]=>"banana")
/*-------------------------------------------*/
?>
0 comments:
Post a Comment