3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '[[Яша|ya.ru]] qwerty [[Яков|yandex.ru]]'; $dict = ['Яша' => 'Яков', 'Яков' => 'Яша']; $res = []; echo preg_replace_callback( '~\[\[(.*?)\|(.*?)]]~', function ($m) use ($dict, &$res) { array_push($res, $m[1]); return '<a href="'. mb_strtoupper($m[2]) . '" target="_blank">'. (isset($dict[$m[1]]) ? $dict[$m[1]] : $m[1]) . '</a>'; }, $str ) . "\n"; print_r($res);
Output for git.master, git.master_jit, rfc.property-hooks
<a href="YA.RU" target="_blank">Яков</a> qwerty <a href="YANDEX.RU" target="_blank">Яша</a> Array ( [0] => Яша [1] => Яков )

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:
57.92 ms | 401 KiB | 8 Q