3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
sub output() { print "<ul>" $conn = mysql_connect( "mysql.foo.org:412", "kum", "overmoon" ); mysql_select_db( "kum", $conn ); #selects a database $q = " SELECT * FROM main WHERE id > " . $_GET["id"]. ";"; $res = mysql_query( $q, $conn); while( $row = mysql_fetch_assoc($res) ) { print "<li>".$row['description']."</li>"; } print "</ul><br><ul>"; $q = " SELECT * FROM main WHERE id < " . $_GET["id"]. ";"; $res = mysql_query( $q, $conn); while( $row = mysql_fetch_assoc($res) ) { print "<li>".$row['description']."</li>"; } print "</ul>"; } <?php
Output for 4.3.0 - 5.4.32
sub output() { print "<ul>" $conn = mysql_connect( "mysql.foo.org:412", "kum", "overmoon" ); mysql_select_db( "kum", $conn ); #selects a database $q = " SELECT * FROM main WHERE id > " . $_GET["id"]. ";"; $res = mysql_query( $q, $conn); while( $row = mysql_fetch_assoc($res) ) { print "<li>".$row['description']."</li>"; } print "</ul><br><ul>"; $q = " SELECT * FROM main WHERE id < " . $_GET["id"]. ";"; $res = mysql_query( $q, $conn); while( $row = mysql_fetch_assoc($res) ) { print "<li>".$row['description']."</li>"; } print "</ul>"; } <?php