<?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);
You have javascript disabled. You will not be able to edit any code.