3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = 'hello | Hello there price | Lets talk about our support. how are you ?| Im fine '; $avp = []; if (preg_match_all('/^ \h* (?<key>[^|]+?) \h* \| \h* (?<value>[^$]+?) \h* $ /mx', $data, $matches, PREG_SET_ORDER)) { foreach ($matches as [, $key, $value]) { $avp[$key] = $value; } } print_r($avp); $word = 'how are you ?'; echo $avp[$word];
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [hello] => Hello there [price] => Lets talk about our support. [how are you ?] => Im fine ) Im fine

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