3v4l.org

run code in 300+ PHP versions simultaneously
<?php function process_template($html,$b='<<',$e='>>'){ $replace=['this'=>'<input name="this" />','that'=>'<input name="that" />']; if(preg_match_all('/('.$b.')(.*?)('.$e.')/is',$html,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE)){ $t='';$o=0; foreach($matches as $m){ $t.=substr($html,$o,$m[0][1]-$o); $t.=$replace[$m[2][0]]; $o=$m[3][1]+strlen($m[3][0]); } $t.=substr($html,$o); $html=$t; } return $html; } $html=" <div> <<this>> <<that>> </div> "; $new=process_template($html); echo $new;
Output for git.master, git.master_jit, rfc.property-hooks
<div> <input name="this" /> <input name="that" /> </div>

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