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 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function ereg() in /in/vRHi2:12 Stack trace: #0 /in/vRHi2(20): DB->bindReplace(':products_price', '10.000') #1 {main} thrown in /in/vRHi2 on line 12
Process exited with code 255.
Output for 4.3.0 - 4.4.9, 5.1.3 - 5.2.17, hhvm-3.10.0 - 3.12.0
update :table_foo set products_price = 10.000, products_price_ek = :products_price_ek
Output for 5.3.0 - 5.6.28
Deprecated: Function ereg() is deprecated in /in/vRHi2 on line 12 update :table_foo set products_price = 10.000, products_price_ek = :products_price_ek
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/vRHi2 on line 3 update :table_foo set products_price = 10.000, products_price_ek = :products_price_ek