3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function comment_retrieve($amount = 0, $username = null, $file = null) { if ($file) { if ($username) { $querystring_file = ' AND fc_file=\'' . $file . '\''; } else { $querystring_file = ' WHERE fc_file=\'' . $file . '\''; } } else { $querystring_file = ''; } if ($username) { $querystring_username = ' WHERE fc_user=\'' . $username . '\''; } else { $querystring_username = ''; } if ($amount > 0) { $querystring_amount = ' LIMIT ' . $amount; } else { $querystring_amount = ''; } // query $querystring = "SELECT * FROM file_comments" . $querystring_username . $querystring_file . ' ORDER BY fc_time DESC' . $querystring_amount;return $querystring; } echo comment_retrieve(5345,'robert','YIFU76R3');
Output for 4.3.0 - 7.1.0
SELECT * FROM file_comments WHERE fc_user='robert' AND fc_file='YIFU76R3' ORDER BY fc_time DESC LIMIT 5345