3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attributes = array(); $htmlcontent = '<img alt="" src="{assets_2100:{filedir_12}HappyDog.jpg}" style="height:400px; width:100px">'; preg_replace_callback('/src=(\'|")(.*?)\1/', function($matches) use ($attributes) { global $attributes; $terms = preg_split('/\{|\}/', $matches[2], -1, PREG_SPLIT_NO_EMPTY); foreach($terms as $key => $term) { if($key != (count($terms) - 1)) { $params = explode('_', $term); $attributes['data-' . rtrim($params[0], ':')] = $params[1]; } else { $attributes['src'] = 'uploads/' . $term; } } }, $htmlcontent); print_r($attributes);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [data-assets] => 2100: [data-filedir] => 12 [src] => uploads/HappyDog.jpg )

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