<?php
function f(){}
f(print "Jack\n");
$a=null;
f(print ++$a . "\n");
print strlen(4) . "\n";
class C {
function C(){}
}
new C(print ++$a);
$a = 10;
echo "\nCount: ",count($a),"\n";
$n=NULL;
$nn = $n;
--$nn;
$n++;
var_dump($nn,$n);
$s = "mehea";
$s++;
var_dump($s);
$s--;
var_dump($s);
class A {
}
class B extends A {
public function __construct() {
// make sure parent constructor gets called if someone adds one
parent::__construct();
}
}
new B();
Jack
1
1
2
Count:
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, int given in /in/bTsZK:13
Stack trace:
#0 {main}
thrown in /in/bTsZK on line 13
Process exited with code 255.
Output for 8.0.0 - 8.0.9
Jack
1
1
2
Count:
Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, int given in /in/bTsZK:13
Stack trace:
#0 {main}
thrown in /in/bTsZK on line 13
Process exited with code 255.
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in /in/bTsZK on line 8
Jack
1
1
2
Count:
Warning: count(): Parameter must be an array or an object that implements Countable in /in/bTsZK on line 13
1
NULL
int(1)
string(5) "meheb"
string(5) "meheb"
Fatal error: Uncaught Error: Cannot call constructor in /in/bTsZK:31
Stack trace:
#0 /in/bTsZK(35): B->__construct()
#1 {main}
thrown in /in/bTsZK on line 31
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Jack
1
1
2
Count:
Warning: count(): Parameter must be an array or an object that implements Countable in /in/bTsZK on line 13
1
NULL
int(1)
string(5) "meheb"
string(5) "meheb"
Fatal error: Uncaught Error: Cannot call constructor in /in/bTsZK:31
Stack trace:
#0 /in/bTsZK(35): B->__construct()
#1 {main}
thrown in /in/bTsZK on line 31
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in /in/bTsZK on line 8
Jack
1
1
2
Count: 1
NULL
int(1)
string(5) "meheb"
string(5) "meheb"
Fatal error: Uncaught Error: Cannot call constructor in /in/bTsZK:31
Stack trace:
#0 /in/bTsZK(35): B->__construct()
#1 {main}
thrown in /in/bTsZK on line 31
Process exited with code 255.
Jack
1
1
2
Count: 1
NULL
int(1)
string(5) "meheb"
string(5) "meheb"
Fatal error: Cannot call constructor in /in/bTsZK on line 31
Process exited with code 255.
Jack
1
1
2
Count: 1
NULL
int(1)
string(5) "meheb"
string(5) "meheb"
Fatal error: Can not call constructor in /in/bTsZK on line 31
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/bTsZK on line 29
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/bTsZK on line 29
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/bTsZK on line 29
Process exited with code 255.