3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "resource_id_heeelp_lala_klopsiki"; preg_match_all('/(_[\w]{1})/', $string, $matches); if(!empty($matches[0])){ foreach($matches[0] as $key){ $result = substr($key, 0, 1); //result is c $result1=str_replace($result,'',$key);//now your result1 is apitalize $result2=ucfirst($result1); //now result2 is Apitalize $finalresult=$result.$result2 ///now your finalresult is cApitalize preg_replace($key, $finalresult, $string); } print $string;
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'preg_replace' (T_STRING) in /in/Nv7gm on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING in /in/Nv7gm on line 12
Process exited with code 255.

preferences:
181.5 ms | 1395 KiB | 65 Q