01: !0 // absolute best score 2 : vv
//~02: 0,a // absolute best score 3 : vv // old question
02: str_rot13 // absolute best score 9 : vv
03: !0 // absolute best score 2 : vv
04: 0 // absolute best score 1 : vv
05: 𡃁 // absolute best score 1 : vv
06: $a=function()use(&$a){return$a;} // absolute best score 22 : xx 32
07: (object)[1] // absolute best score 12 : vv
08: // absolute best score 23 : xx --
09: a // absolute best score 1 : vv
10: function(&$a){$a=new Bar(1);} // absolute best score 29 : vv
11: [] // absolute best score 2 : vv
hint from @iansltx: drop the space after the return (Q6: 33 -> 32)
// Q1:
function foo($x){
return $x;
}
// Q2:
function foo($x){
return $x('gehr') === 'true';
}
// Q3:
function foo($x){
return ($x >= 1) && ($x <= 1) && ($x !== 1);
}
// Q4:
function foo($x){
$a = 0;
switch ($a) {
case $x:
return true;
case 0:
return false;
}
return false;
}
// Q5:
function foo($x){
return strlen($x) === 4;
}
// Q6:
function foo($x){
return $x === $x();
}
// Q7:
function foo(stdClass $x){
$x = (array) $x;
return $x[0];
}
// Q8:
class Bar {}
function foo(Bar $x){
return get_class($x) != 'Bar';
}
// Q9
function foo($x){
$y = $x + 1;
return ++$x != $y;
}
// Q10:
class Bar{
private $a;
public function __construct($a){
$this->a = (bool) $a;
}
public function a(){
return $this->a;
}
}
function foo(callable $x){
$object = new Bar(false);
$x($object);
return $object->a();
}
// Q11
function foo(array $x){
return $x[0] === null;
}
Hey, 7 isn't correct no ? It should be !0 ?
(And the score is still at 0)
Thanks for the other answer though ! :D