IT Questions and Answers :)

Monday, March 22, 2021

In PHP, what is function for outputting the contents of an array at runtime?

 In PHP, what is function for outputting the contents of an array at runtime?

  • print()
  • print_array()
  • print_r()
  • echo               
In PHP, what is function for outputting the contents of an array at runtime?


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")

/*-------------------------------------------*/
?>


SOURCE

http://php.net/manual/en/function.print-r.php
Share:

0 comments:

Post a Comment

Popular Posts