Difference between revisions of "PHP - Adding values to an array"

From MyWiki
Jump to: navigation, search
(Created page with "<source lang="php"> <?php $stack = array("orange", "banana"); array_push($stack, "apple", "raspberry"); print_r($stack); ?> </source>")
 
Line 7: Line 7:
 
?>
 
?>
 
</source>
 
</source>
 +
print_r prints a variable in human readable format<br>

Revision as of 12:37, 4 April 2019

<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>

print_r prints a variable in human readable format