note 119815 added to intro.spl-types
| From: | jlozares at gmail dot com | Date: | Wed, 31 Aug 2016 14:25:10 +0000 |
| Subject: | note 119815 added to intro.spl-types | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206430@lists.php.net to get a copy of this message | ||
abstract class ContainerType{
protected $value;
protected $length;
protected $isRealContainer;
abstract protected function get_length();
abstract protected function is_real_container();
abstract protected function init();
}
class JLNumber extends ContainerType{
public $value;
public $length;
public $isRealContainer;
public function __construct($val){
$this->value = $val;
$this->length = 0;
$this->isRealContainer = FALSE;
return $this->init();
}
protected function get_length(){
$this->length = strlen(trim($this->value));
return $this;
}
protected function is_real_container(){
$this->isRealContainer = is_numeric($this->value);
return $this->isRealContainer;
}
protected function init(){
if($this->is_real_container()){
$this->get_length();
}else{
$this->value="";
}
return $this;
}
public function __toString(){
$real = ($this->isRealContainer)?"TRUE":"FALSE";
$str = "<pre>";
$str .= "Class Name : ".get_class()."<br>";
$str .= "Type : Number<br>";
$str .= "Value : ".$this->value."<br>";
$str .= "Length : ".$this->length."<br>";
$str .= "Is Real Number : ".$real."<br><br>";
$str .= "</pre>";
return $str;
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 130.105.201.21
----
Manual Page -- http://php.net/manual/en/intro.spl-types.php
Edit -- https://master.php.net/note/edit/119815
Del: integrated -- https://master.php.net/note/delete/119815/integrated
Del: useless -- https://master.php.net/note/delete/119815/useless
Del: bad code -- https://master.php.net/note/delete/119815/bad+code
Del: spam -- https://master.php.net/note/delete/119815/spam
Del: non-english -- https://master.php.net/note/delete/119815/non-english
Del: in docs -- https://master.php.net/note/delete/119815/in+docs
Del: other reasons-- https://master.php.net/note/delete/119815
Reject -- https://master.php.net/note/reject/119815
Search -- https://master.php.net/manage/user-notes.php