3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatFieldKey($key_raw) { $re = '/([\w]+)/$1/'; $key = explode('_', $key_raw); print_r($key); $final_key = array(); foreach ($key as $word) { array_push(preg_replace('/(\b[a-z]{1})/', strtoupper(${1}), $word), $final_key); } return $final_key; } echo formatFieldKey('field_some_request');
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => field [1] => some [2] => request ) Warning: Undefined variable $1 in /in/521Ep on line 11 Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /in/521Ep on line 11 Notice: Only variables should be passed by reference in /in/521Ep on line 11 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, string given in /in/521Ep:11 Stack trace: #0 /in/521Ep(11): array_push('ield', Array) #1 /in/521Ep(17): formatFieldKey('field_some_requ...') #2 {main} thrown in /in/521Ep on line 11
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
167.85 ms | 406 KiB | 5 Q