3v4l.org

run code in 300+ PHP versions simultaneously
<?php $w="War and 12 Peace3"; for($l=$i=mb_strlen($w);$i--;){ $c=array_sum(unpack("C*",mb_substr($w,$i,1))); 96<$c&&$c<123 and $v+=$c-96 or 64<$c&&$c<91 and $v+=1.5*$c-96 or 48<$c&&$c>32||$c>57&&$c<127 and $v-=1; echo "$v,"; } echo $v/$l,"\n"; preg_match_all("/\d+/",$w,$m);echo array_sum($m[0]); echo PHP_MAX_INT, " ", ~0;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $v in /in/3Iqpk on line 6 -1,4,7,8,13,37,37,36,35,35,39,53,54,54,72,73,107.5,6.3235294117647 15 Fatal error: Uncaught Error: Undefined constant "PHP_MAX_INT" in /in/3Iqpk:12 Stack trace: #0 {main} thrown in /in/3Iqpk on line 12
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: v in /in/3Iqpk on line 6 -1,4,7,8,13,37,37,36,35,35,39,53,54,54,72,73,107.5,6.3235294117647 15 Warning: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' (this will throw an Error in a future version of PHP) in /in/3Iqpk on line 12 PHP_MAX_INT -1
Output for 7.3.32 - 7.3.33
-1,4,7,8,13,37,37,36,35,35,39,53,54,54,72,73,107.5,6.3235294117647 15 Warning: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' (this will throw an Error in a future version of PHP) in /in/3Iqpk on line 12 PHP_MAX_INT -1
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Undefined variable: v in /in/3Iqpk on line 6 -1,4,7,8,13,37,37,36,35,35,39,53,54,54,72,73,107.5,6.3235294117647 15 Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/3Iqpk on line 12 PHP_MAX_INT -1

preferences:
342.32 ms | 403 KiB | 376 Q