3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_REQUEST['token_pre_pop'] = true; $_REQUEST['ids'] = '1000';//,1002,1004'; if (isset($_REQUEST['token_pre_pop'])) { $ids = $_REQUEST['ids']; $ids = explode(",", urldecode($ids)); if (!is_array($ids)) { $ids = "'".implode("','", $ids)."'"; //$query = "SELECT `username` FROM `logins`.`users` WHERE `id` IN ($ids)"; //$result = $db->query($query) or die(bad_query_emailer($db->error,"File: ".__FILE__." Line: ".__LINE__,"There was a database error. This is being investigated.")); //$name = $result->fetch_assoc(); //echo '{"'.$name.'"}'; // JSONed //echo $ids; } else { //$query = "SELECT `username` FROM `logins`.`users` WHERE `id` = '%s'"; //$result = $db->query($query, $ids) or die(bad_query_emailer($db->error,"File: ".__FILE__." Line: ".__LINE__,"There was a database error. This is being investigated.")); //$names = array(); //while ($row = $result->fetch_assoc()) { // $names[] = $row['username']; //} //echo json_encode($names); $ids = json_encode($ids); echo $ids; } }
based on SKgWB
Output for 5.2.0 - 7.2.0
["1000"]
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/aKf9J on line 25
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/aKf9J on line 25
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/aKf9J on line 25
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/aKf9J on line 25