3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bg = array('back1.jpg', 'back2.jpg' ); // array of filenames $i = rand(0, count($bg)-1); // generate random number size of the array $selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen <script> $('body').css('background', selectedBg); </script> ?>
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected '<', expecting end of file in /in/lgidT on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected '<' in /in/lgidT on line 5
Process exited with code 255.

preferences:
171.2 ms | 1395 KiB | 25 Q