3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file_content = "Employees are employees_category MyEmployees kitEMPLOYEESMATCH"; $f = 'employees'; $r = 'vehicles'; $pattern = '~(' . implode( ')|(', [ preg_quote($f, '~'), preg_quote(ucfirst($f), '~'), preg_quote(strtoupper($f), '~') ] ) . ')~'; $lookup = [ 1 => $r, 2 => ucfirst($r), 3 => strtoupper($r) ]; var_export( preg_replace_callback( $pattern, function($m) use ($lookup) { return $lookup[count($m) - 1]; }, $file_content ) );
Output for git.master, git.master_jit, rfc.property-hooks
'Vehicles are vehicles_category MyVehicles kitVEHICLESMATCH'

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:
26.14 ms | 405 KiB | 5 Q