3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $config = array( 'key' => array( '/text/' => '/main/') ); $dataKey='/chat/'; foreach ($config['key'] as $url => $key) { $quoted = preg_quote($url, '/'); $countReplacements = 0; if (null !== $res = preg_replace('/' . $quoted . '/', $key, $dataKey, -1, $countReplacements) && $countReplacements >= 0) { var_dump( $res ); }else{ echo 'rape'; } }
Output for 5.1.0 - 7.1.0
bool(true)
Output for 4.3.0 - 5.0.5
Warning: Wrong parameter count for preg_replace() in /in/m6lJJ on line 10 bool(false)