3v4l.org

run code in 300+ PHP versions simultaneously
<?php function minimize($file) { return preg_replace('#(<\?php)\s+#S','$1 ',preg_replace('#\s*([(){}[\];,.:+<>*/%^=&?|$-])\s*#S', '$1', array_reduce(token_get_all(php_strip_whitespace($file)),function($c,$x){ static $s = [], $i=0; if ( is_string($x) ) return $c . $x; $_ = $x[1]; switch($x[0]){ case T_STRING: return $c . (defined($_) ? (is_bool($k=constant($_))||is_null($k)?$_:$k) : $_); case T_VARIABLE: return $c . (empty($s[$_]) ? ($s[$_] = '$_' . base_convert($i++,10,36)) : $s[$_]); case T_LOGICAL_OR: return $c . '||'; case T_LOGICAL_AND: return $c . '&&'; default: return $c . $_; } }))); } echo minimize(__FILE__);
Output for git.master, git.master_jit, rfc.property-hooks
<?php function minimize($_0){return preg_replace('#(<\?php)\s+#S','$1 ',preg_replace('#\s*([(){}[\];,.:+<>*/%^=&?|$-])\s*#S','$1',array_reduce(token_get_all(php_strip_whitespace($_0)),function($_1,$_2){static$_3=[],$_4=0;if(is_string($_2))return$_1.$_2;$_5=$_2[1];switch($_2[0]){case 313:return$_1.(defined($_5)?(is_bool($_6=constant($_5))||is_null($_6)?$_5:$_6):$_5);case 317:return$_1.(empty($_3[$_5])?($_3[$_5]='$_'.base_convert($_4++,10,36)):$_3[$_5]);case 264:return$_1.'||';case 266:return$_1.'&&';default:return$_1.$_5;}})));}echo minimize(__FILE__);

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:
41.5 ms | 402 KiB | 8 Q