3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $success; private $id; public function pub($id) { $this->id = $id; $this->success = $this->test(); } private function test() { $getArg = $this->id; if ($getArg (is_numeric($getArg) || $getArg === 'test')) { return true; } return false; } } $a = new A(); $a->pub('1'); var_dump($a->success);

preferences:
34.22 ms | 402 KiB | 5 Q