<?php
class p {
public $name = 'p';
function getname(){
return $this->name;
}
}
class c1 extends p {
public $name = 'c1';
}
class c2 extends p {
public $name = 'c2';
}
$p = new p;
$c1 = new c1;
$c2 = new c2;
echo $p->getname();
echo $c1->getname();
echo $c2->getname();
public static function valid($value, $type)
{
if ($type == 'float')
{
if($value != floatval($value)) return null;
}
else if ($type == 'int' || $type == 'table')
{
return intval($value);
}
else
return $value;
}