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})/g', strtoupper("${1}"), $word), $final_key); } return $final_key; } echo formatFieldKey('field_some_request');
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Using ${expr} (variable variables) in strings is deprecated, use {${expr}} instead in /in/i0AA9 on line 11 Array ( [0] => field [1] => some [2] => request ) Warning: Undefined variable $1 in /in/i0AA9 on line 11 Warning: preg_replace(): Unknown modifier 'g' in /in/i0AA9 on line 11 Notice: Only variables should be passed by reference in /in/i0AA9 on line 11 Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /in/i0AA9:11 Stack trace: #0 /in/i0AA9(11): array_push(NULL, Array) #1 /in/i0AA9(17): formatFieldKey('field_some_requ...') #2 {main} thrown in /in/i0AA9 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:
176.11 ms | 406 KiB | 5 Q