3v4l.org

run code in 300+ PHP versions simultaneously
<?php function do_thing() { // In the future grab the settings from admincp $groups_to_check = array_map('intval', explode(',','2,5')); // This will check if groups to check setting is valid if(is_array($groups_to_check) && count($groups_to_check)) { // Implode to use in SQL query $groups_to_check = implode(',',$groups_to_check); } else { return false; } var_dump($groups_to_check); $a_week_ago = time() - 604800; $prefix = 'mybb'; // This will select users that registed more than a week ago, belong to groups to check, lastpost and timeonline are zero and don't have any additional groups // Why this? // regdate check gives users a grace time to their first login // timeonline check the last time they were online (0 is never) // lastpost check the time they last posted (I do this for sanity, 0 is never) // usergroup check ensures that only registered and awaiting activation are checked (groups 2 and 5, should be made configurable in the future) // additionalgroups check ensures my custom edited users don't get checked @sql_query("SELECT * FROM `{prefix}users` WHERE ((regdate < {$a_week_ago}) AND lastpost = 0 AND timeonline = 0 AND usergroup IN ({$groups_to_check}) AND additionalgroups = '');"); } do_thing();
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.6
string(3) "2,5" Fatal error: Uncaught Error: Call to undefined function sql_query() in /in/tZeE9:30 Stack trace: #0 /in/tZeE9(33): do_thing() #1 {main} thrown in /in/tZeE9 on line 30
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20
string(3) "2,5"
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(3) "2,5"

preferences:
161.99 ms | 401 KiB | 214 Q