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]; if ( $x[0] == 310 ) return $c . (defined($_) ? (is_bool($k=constant($_))||is_null($k)?$_:$k) : $_); if ( $x[0] == 312 ) return $c . (empty($s[$_]) ? ($s[$_] = '$_' . base_convert($i++,10,36)) : $s[$_]); if ( $x[0] == 263 ) return $c . '||'; if ( $x[0] == 265 ) return $c . '&&'; return $c . $_; }))); } echo minimize(__FILE__);
Output for git.master, git.master_jit, rfc.property-hooks
<?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];if($x[0]==310)return$c.(defined($_)?(is_bool($k=constant($_))||is_null($k)?$_:$k):$_);if($x[0]==312)return$c.(empty($s[$_])?($s[$_]='$_'.base_convert($i++,10,36)):$s[$_]);if($x[0]==263)return$c.'||';if($x[0]==265)return$c.'&&';return$c.$_;})));}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:
47.16 ms | 402 KiB | 8 Q