php-transpiler
php-transpiler copied to clipboard
Add strlen to isset optimization
Checks like
if(strlen($string) > 5)
can be optimized into a faster isset like
if(isset($string[5]))
This can easily be implemented. It needs a check to prevent this optimization when it comes to nested assignment like
if( ($length = strlen($string)) > 5)
though. Obviously in this case the optimization makes no sense.