3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function comment_retrieve($amount = 0, $username = null, $file = null) { if ($file) { if ($amount > 0) { $querystring_file = ' AND `c_username` = ' . $username; } else { $querystring_file = ' WHERE `c_username` = ' . $username; } } else { $querystring_file = ''; } if ($username) { $querystring_username = ' WHERE `c_username` = ' . $username; } else { $querystring_username = ''; } if ($amount > 0) { $querystring_amount = ' LIMIT ' . $amount; } else { $querystring_amount = ''; } // query $querystring = "SELECT * FROM file_comments" . $querystring_username . $querystring_amount; return $querystring; } echo comment_retrieve(7,bob,HJFG);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Use of undefined constant bob - assumed 'bob' in /in/6L94V on line 34 Notice: Use of undefined constant HJFG - assumed 'HJFG' in /in/6L94V on line 34 SELECT * FROM file_comments WHERE `c_username` = bob LIMIT 7