3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $in = ["War and Peace", "Reading Rainbow: The Best Unicorn Ever", "Maus", "Home for a Bunny"]; for(;$w=each($in);$S[]=$w){ 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; } $v=$v/l; preg_match_all("/\d+/",$w,$m); $v-=array_sum($m[0]); preg_match("/((^| )R.*){2}/",$w)&&$v=-1^1<<63; $t[]=$v; } array_multisort($t,$S); var_dump($S);
Output for 7.2.0
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/YWIl7 on line 7 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Warning: Use of undefined constant l - assumed 'l' (this will throw an Error in a future version of PHP) in /in/YWIl7 on line 12 Notice: Undefined variable: v in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Warning: Use of undefined constant l - assumed 'l' (this will throw an Error in a future version of PHP) in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Warning: Use of undefined constant l - assumed 'l' (this will throw an Error in a future version of PHP) in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Warning: Use of undefined constant l - assumed 'l' (this will throw an Error in a future version of PHP) in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 array(4) { [0]=> array(4) { [1]=> string(16) "Home for a Bunny" ["value"]=> string(16) "Home for a Bunny" [0]=> int(3) ["key"]=> int(3) } [1]=> array(4) { [1]=> string(38) "Reading Rainbow: The Best Unicorn Ever" ["value"]=> string(38) "Reading Rainbow: The Best Unicorn Ever" [0]=> int(1) ["key"]=> int(1) } [2]=> array(4) { [1]=> string(4) "Maus" ["value"]=> string(4) "Maus" [0]=> int(2) ["key"]=> int(2) } [3]=> array(4) { [1]=> string(13) "War and Peace" ["value"]=> string(13) "War and Peace" [0]=> int(0) ["key"]=> int(0) } }
Output for 7.1.10
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Notice: Undefined variable: v in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 array(4) { [0]=> array(4) { [1]=> string(16) "Home for a Bunny" ["value"]=> string(16) "Home for a Bunny" [0]=> int(3) ["key"]=> int(3) } [1]=> array(4) { [1]=> string(38) "Reading Rainbow: The Best Unicorn Ever" ["value"]=> string(38) "Reading Rainbow: The Best Unicorn Ever" [0]=> int(1) ["key"]=> int(1) } [2]=> array(4) { [1]=> string(4) "Maus" ["value"]=> string(4) "Maus" [0]=> int(2) ["key"]=> int(2) } [3]=> array(4) { [1]=> string(13) "War and Peace" ["value"]=> string(13) "War and Peace" [0]=> int(0) ["key"]=> int(0) } }
Output for 7.1.0 - 7.1.7
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Notice: Undefined variable: v in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: A non-numeric value encountered in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 array(4) { [0]=> array(4) { [1]=> string(13) "War and Peace" ["value"]=> string(13) "War and Peace" [0]=> int(0) ["key"]=> int(0) } [1]=> array(4) { [1]=> string(38) "Reading Rainbow: The Best Unicorn Ever" ["value"]=> string(38) "Reading Rainbow: The Best Unicorn Ever" [0]=> int(1) ["key"]=> int(1) } [2]=> array(4) { [1]=> string(4) "Maus" ["value"]=> string(4) "Maus" [0]=> int(2) ["key"]=> int(2) } [3]=> array(4) { [1]=> string(16) "Home for a Bunny" ["value"]=> string(16) "Home for a Bunny" [0]=> int(3) ["key"]=> int(3) } }
Output for 5.4.1 - 7.0.20
Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Notice: Undefined variable: v in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 Warning: mb_strlen() expects parameter 1 to be string, array given in /in/YWIl7 on line 8 Notice: Use of undefined constant l - assumed 'l' in /in/YWIl7 on line 12 Warning: Division by zero in /in/YWIl7 on line 12 Warning: preg_match_all() expects parameter 2 to be string, array given in /in/YWIl7 on line 13 Warning: array_sum() expects parameter 1 to be array, null given in /in/YWIl7 on line 14 Warning: preg_match() expects parameter 2 to be string, array given in /in/YWIl7 on line 15 array(4) { [0]=> array(4) { [1]=> string(16) "Home for a Bunny" ["value"]=> string(16) "Home for a Bunny" [0]=> int(3) ["key"]=> int(3) } [1]=> array(4) { [1]=> string(4) "Maus" ["value"]=> string(4) "Maus" [0]=> int(2) ["key"]=> int(2) } [2]=> array(4) { [1]=> string(38) "Reading Rainbow: The Best Unicorn Ever" ["value"]=> string(38) "Reading Rainbow: The Best Unicorn Ever" [0]=> int(1) ["key"]=> int(1) } [3]=> array(4) { [1]=> string(13) "War and Peace" ["value"]=> string(13) "War and Peace" [0]=> int(0) ["key"]=> int(0) } }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/YWIl7 on line 3
Process exited with code 255.