Machs doch so:
PHP-Code:
<?php
class test {
protected $a = null;
public function __construct(){
# irgendwas...
}
public function istZahl{$a){
return ctype_digit($a)
? $a
: null;
}
}
function ausgabe($x){
if (is_null($x)){
echo $x . ' ist keine Zahl.';
}else{
echo$x . ' ist eine Zahl.'
}
}
$t = new test();
ausgabe($t->istZahl('a'));
ausgabe($t->istZahl('123456');
?>