3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $whereClause = ""; $criteria = array("id" => 1, 'tableName' => 'blarg'); foreach($criteria as $key => $value) { switch($key) { case 'tableName': $whereClause .= " WHERE tableName = " . $this->db->qstr($value) . " AND"; break; case 'id': $whereClause .= " WHERE id = " . intval($value) . " AND"; break; case 'translatable': $whereClause .= " WHERE translatable = " . intval($value) . " AND"; break; } } var_dump($whereClause);
based on uqBkG
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/lnIiY:8 Stack trace: #0 {main} thrown in /in/lnIiY on line 8
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Using $this when not in object context in /in/lnIiY on line 8
Process exited with code 255.