<?php
$in = ["War and Peace",
"Reading Rainbow: The Best Unicorn Ever",
"Maus",
"Home for a Bunny"];
for(;list($k,$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);
Fatal error: Uncaught Error: Call to undefined function each() in /in/6M9UF:7
Stack trace:
#0 {main}
thrown in /in/6M9UF on line 7
Process exited with code 255.
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/6M9UF on line 7
Notice: Undefined variable: v in /in/6M9UF on line 10
array(4) {
[0]=>
string(13) "War and Peace"
[1]=>
string(16) "Home for a Bunny"
[2]=>
string(4) "Maus"
[3]=>
string(38) "Reading Rainbow: The Best Unicorn Ever"
}
Output for 7.3.32 - 7.3.33
array(4) {
[0]=>
string(13) "War and Peace"
[1]=>
string(16) "Home for a Bunny"
[2]=>
string(4) "Maus"
[3]=>
string(38) "Reading Rainbow: The Best Unicorn Ever"
}
Notice: Undefined variable: v in /in/6M9UF on line 10
array(4) {
[0]=>
string(13) "War and Peace"
[1]=>
string(16) "Home for a Bunny"
[2]=>
string(4) "Maus"
[3]=>
string(38) "Reading Rainbow: The Best Unicorn Ever"
}