3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' <div class="temp"> [title type="text" tag="h2" value="This is my cool title" disabled some-attribute] [text type="text" tag="p" value="Lorem ipsum dolor sit amet"] </div> '; preg_match_all('/\[(.*?)\]/', $html, $matches); $result = []; foreach ($matches[1] as $match) { $id = strtok($match, ' '); $tag = ['id' => $id]; while ($token = strtok(' ')) { if (str_contains($token, '=')) { [$key, $value] = explode('=', $token); if (str_ends_with($token, '"')) { $tag[$key] = trim($value, '"'); continue; } $value2 = strtok('"'); $tag[$key] = trim("$value $value2", '"'); continue; } $tag[$token] = true; } $result[] = $tag; } print_r($result);
Output for git.master, git.master_jit
/bin/php-git-master: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory
Process exited with code 127.
Output for rfc.property-hooks
Array ( [0] => Array ( [id] => title [type] => text [tag] => h2 [value] => This is my cool title [disabled] => 1 [some-attribute] => 1 ) [1] => Array ( [id] => text [type] => text [tag] => p [value] => Lorem ipsum dolor sit amet ) )

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:
34.29 ms | 407 KiB | 5 Q