3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class DB { var $sql_query = 'update :table_foo set products_price = :products_price', products_price_ek = :products_price_ek; function bindReplace($place_holder, $value) { $pos = strpos($this->sql_query, $place_holder); if ($pos !== false) { $length = strlen($place_holder); $character_after_place_holder = substr($this->sql_query, $pos+$length, 1); if (($character_after_place_holder === false) || ereg('[ ,)"]', $character_after_place_holder)) { $this->sql_query = substr_replace($this->sql_query, $value, $pos, $length); } } } } $obj = new DB; $obj->bindReplace(':products_price', '10.000'); echo $obj->sql_query; ?>
Output for 5.4.0 - 5.5.6
Parse error: syntax error, unexpected 'products_price_ek' (T_STRING), expecting variable (T_VARIABLE) in /in/AQ25P on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/AQ25P on line 3
Process exited with code 255.