3v4l.org

run code in 300+ PHP versions simultaneously
<?php $phpExpression = '1 if true else 2 '; while (preg_match('/(.*?)\s*if\s*(.*?)\s*else\s*(.*)/', $phpExpression, $match)){ var_dump( $phpExpression); $phpExpression = str_replace($match[0],'(('.$match[2].')?('.$match[1].'):('.$match[3].'))',$phpExpression); } var_dump( $phpExpression);

preferences:
33.58 ms | 406 KiB | 5 Q