@ 2022-08-14T16:19:40Z <?php
class Foo {
public $public_parent;
protected $protected_parent;
private $private_parent;
public function whoami() {
echo PHP_EOL, __METHOD__, PHP_EOL;
echo 'self::class: ', self::class, PHP_EOL;
echo 'static::class: ', static::class, PHP_EOL;
echo 'property public_parent exists ? ', var_export(property_exists($this, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($this, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($this, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($this, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($this, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($this, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($this, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($this, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($this, 'private_grandchild'), true), PHP_EOL;
}
}
class Foo_Child extends Foo {
public $public_child;
protected $protected_child;
private $private_child;
public function whoami() {
echo PHP_EOL, __METHOD__, PHP_EOL;
echo 'self::class: ', self::class, PHP_EOL;
echo 'static::class: ', static::class, PHP_EOL;
echo 'property public_parent exists ? ', var_export(property_exists($this, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($this, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($this, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($this, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($this, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($this, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($this, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($this, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($this, 'private_grandchild'), true), PHP_EOL;
parent::whoami();
}
}
class Foo_GrandChild extends Foo_Child {
public $public_grandchild;
protected $protected_grandchild;
private $private_grandchild;
public function whoami() {
echo PHP_EOL, __METHOD__, PHP_EOL;
echo 'self::class: ', self::class, PHP_EOL;
echo 'static::class: ', static::class, PHP_EOL;
echo 'property public_parent exists ? ', var_export(property_exists($this, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($this, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($this, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($this, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($this, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($this, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($this, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($this, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($this, 'private_grandchild'), true), PHP_EOL;
parent::whoami();
}
}
echo '==== GRANDCHILD OUTSIDE ====', PHP_EOL;
$foo_grandchild = new Foo_GrandChild;
echo 'property public_parent exists ? ', var_export(property_exists($foo_grandchild, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($foo_grandchild, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($foo_grandchild, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($foo_grandchild, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($foo_grandchild, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($foo_grandchild, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($foo_grandchild, 'private_grandchild'), true), PHP_EOL;
echo PHP_EOL, '==== INSIDE GRANDCHILD ====', PHP_EOL;
$foo_grandchild->whoami();
echo PHP_EOL, '==== CHILD OUTSIDE ====', PHP_EOL;
$foo_child = new Foo_Child;
echo 'property public_parent exists ? ', var_export(property_exists($foo_child, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($foo_child, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($foo_child, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($foo_child, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($foo_child, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($foo_child, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($foo_child, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($foo_child, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($foo_child, 'private_grandchild'), true), PHP_EOL;
echo PHP_EOL, '==== INSIDE GRANDCHILD ====', PHP_EOL;
$foo_child->whoami();
echo PHP_EOL, '==== PARENT OUTSIDE ====', PHP_EOL;
$foo = new Foo;
echo 'property public_parent exists ? ', var_export(property_exists($foo, 'public_parent'), true), PHP_EOL;
echo 'property protected_parent exists ? ', var_export(property_exists($foo, 'protected_parent'), true), PHP_EOL;
echo 'property private_parent exists ? ', var_export(property_exists($foo, 'private_parent'), true), PHP_EOL;
echo 'property public_child exists ? ', var_export(property_exists($foo, 'public_child'), true), PHP_EOL;
echo 'property protected_child exists ? ', var_export(property_exists($foo, 'protected_child'), true), PHP_EOL;
echo 'property private_child exists ? ', var_export(property_exists($foo, 'private_child'), true), PHP_EOL;
echo 'property public_grandchild exists ? ', var_export(property_exists($foo, 'public_grandchild'), true), PHP_EOL;
echo 'property protected_grandchild exists ? ', var_export(property_exists($foo, 'protected_grandchild'), true), PHP_EOL;
echo 'property private_grandchild exists ? ', var_export(property_exists($foo, 'private_grandchild'), true), PHP_EOL;
echo PHP_EOL, '==== INSIDE PARENT ====', PHP_EOL;
$foo->whoami();
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 8.3.6 0.008 0.008 18.42 8.3.5 0.011 0.011 20.15 8.3.4 0.007 0.010 19.97 8.3.3 0.004 0.011 18.84 8.3.2 0.003 0.005 24.18 8.3.1 0.004 0.004 24.66 8.3.0 0.004 0.004 26.16 8.2.18 0.010 0.006 25.92 8.2.17 0.010 0.006 18.96 8.2.16 0.003 0.010 22.96 8.2.15 0.004 0.004 25.66 8.2.14 0.008 0.000 24.66 8.2.13 0.008 0.000 26.16 8.2.12 0.005 0.003 26.16 8.2.11 0.007 0.003 20.64 8.2.10 0.011 0.000 18.03 8.2.9 0.003 0.006 17.88 8.2.8 0.000 0.008 18.78 8.2.7 0.006 0.003 17.59 8.2.6 0.005 0.003 17.63 8.2.5 0.003 0.006 18.04 8.2.4 0.003 0.005 18.28 8.2.3 0.004 0.004 18.20 8.2.2 0.000 0.008 19.42 8.2.1 0.004 0.004 18.21 8.2.0 0.000 0.008 19.21 8.1.28 0.007 0.014 25.92 8.1.27 0.004 0.004 24.66 8.1.26 0.009 0.000 26.35 8.1.25 0.007 0.003 28.09 8.1.24 0.010 0.000 21.01 8.1.23 0.008 0.004 21.09 8.1.22 0.008 0.000 18.69 8.1.21 0.003 0.005 18.77 8.1.20 0.003 0.007 17.47 8.1.19 0.006 0.003 17.22 8.1.18 0.005 0.003 18.10 8.1.17 0.003 0.005 17.62 8.1.16 0.003 0.006 19.17 8.1.15 0.004 0.004 18.73 8.1.14 0.004 0.004 17.55 8.1.13 0.000 0.007 19.09 8.1.12 0.007 0.000 17.45 8.1.11 0.003 0.006 17.57 8.1.10 0.005 0.003 17.46 8.1.9 0.006 0.003 17.55 8.1.8 0.006 0.011 17.41 8.1.7 0.014 0.002 17.36 8.1.6 0.016 0.003 17.70 8.1.5 0.017 0.004 17.63 8.1.4 0.011 0.007 17.56 8.1.3 0.016 0.004 17.78 8.1.2 0.011 0.007 17.73 8.1.1 0.013 0.006 17.76 8.1.0 0.010 0.010 17.67 8.0.30 0.003 0.005 18.77 8.0.29 0.005 0.003 16.88 8.0.28 0.004 0.004 18.48 8.0.27 0.004 0.004 16.89 8.0.26 0.003 0.003 18.64 8.0.25 0.007 0.000 17.11 8.0.24 0.008 0.000 17.11 8.0.23 0.005 0.003 16.95 8.0.22 0.006 0.006 16.95 8.0.21 0.015 0.000 16.92 8.0.20 0.016 0.000 16.89 8.0.19 0.011 0.005 16.92 8.0.18 0.011 0.005 16.90 8.0.17 0.012 0.003 16.99 8.0.16 0.013 0.003 16.98 8.0.15 0.012 0.003 16.78 8.0.14 0.014 0.000 16.83 8.0.13 0.009 0.006 16.94 8.0.12 0.008 0.008 16.88 8.0.11 0.011 0.004 16.95 8.0.10 0.010 0.005 16.94 8.0.9 0.016 0.000 17.00 8.0.8 0.012 0.004 16.83 8.0.7 0.011 0.004 16.81 8.0.6 0.007 0.007 16.99 8.0.5 0.006 0.006 17.02 8.0.3 0.006 0.009 17.02 8.0.2 0.008 0.008 16.87 8.0.1 0.005 0.011 17.03 7.4.33 0.007 0.000 16.66 7.4.32 0.007 0.000 16.66 7.4.30 0.011 0.004 16.76 7.4.29 0.014 0.003 16.73 7.4.28 0.012 0.003 16.70 7.4.27 0.017 0.000 16.51 7.4.26 0.013 0.003 16.57 7.4.25 0.010 0.007 16.66 7.4.24 0.004 0.008 16.74 7.4.23 0.010 0.007 16.63 7.4.22 0.008 0.008 16.66 7.4.21 0.005 0.009 16.66 7.4.20 0.011 0.003 16.76 7.4.19 0.012 0.003 16.72 7.4.18 0.014 0.000 16.69 7.4.16 0.007 0.007 16.72 7.4.15 0.009 0.003 16.61 7.4.14 0.005 0.007 16.54 7.4.13 0.006 0.009 16.62 7.4.12 0.015 0.000 16.62 7.4.11 0.012 0.003 16.55 7.4.10 0.015 0.000 16.67 7.4.9 0.012 0.004 16.60 7.4.8 0.009 0.006 16.54 7.4.7 0.017 0.000 16.65 7.4.6 0.011 0.005 16.66 7.4.5 0.012 0.003 16.65 7.4.4 0.012 0.004 16.62 7.4.3 0.000 0.012 16.48 7.4.2 0.013 0.000 16.47 7.4.1 0.015 0.000 16.49 7.4.0 0.013 0.003 16.65
preferences:dark mode live preview
64.63 ms | 401 KiB | 5 Q