3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = "aa\" b \x27 c"; $sum = 0; $inputs = explode("\n", $input); echo addslashes($input); for($i = 0; $i<count($inputs); $i++){ $ns = addslashes($inputs[$i]); for($j = 0; $j<strlen($ns); $j++){ $sum++; if(preg_match("/\\^[\"]/",$ns)>0){ $sum+=2; } } //$sum-= strlen($inputs[$i]); } echo $sum;
based on XCJOq
Output for 5.3.20 - 7.2.0
aa\" b \' c11