3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lookup = [ 'Name' => 'Joseph', 'Name_en' => 'Joe', 'Name_es' => 'Jose', '19' => 'age', '2019' => 'year', '20' => 'next birthday', ]; $str = "Name : Name_en, 2019 19 20"; $subpattern = implode('|', array_map('preg_quote', array_keys($lookup))); echo preg_replace_callback( "#\b($subpattern)\b#", fn($m) => $lookup[$m[0]], $str );
Output for git.master_jit, git.master, rfc.property-hooks
Joseph : Joe, year age next birthday

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:
47.51 ms | 983 KiB | 4 Q