LoopsStuff - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of LoopsStuff.php
- <?php
- //Rules are relaxed in php
- //Simple to declare an array - not restircted to a single data type
- $mybook = array('John', 'Ringo', 'George', 'Paul');
- print_r($mybook); //simple solution for displaying an array
- //echo used most of the time to print.
- //We can loop through our array....
- foreach($mybook as $val) { // as means next element is treated as an element
- echo "<p>$val</p>";
- }