- var_dump: documentation ( source)
- is_numeric: documentation ( source)
<?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);