diff options
Diffstat (limited to '')
-rw-r--r-- | php/phpgats.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/php/phpgats.php b/php/phpgats.php index 10008aa..188dbc0 100644 --- a/php/phpgats.php +++ b/php/phpgats.php | |||
@@ -155,10 +155,19 @@ class phpgats_Integer extends phpgats_Element | |||
155 | 155 | ||
156 | function __construct( $_elem ) | 156 | function __construct( $_elem ) |
157 | { | 157 | { |
158 | if( getType($_elem) != "resource" ) | 158 | if( $_elem === '' ) |
159 | $this->elem = gmp_init(0); | ||
160 | else if( getType($_elem) == "resource" ) | ||
161 | $this->elem = $_elem; | ||
162 | else if( getType($_elem) == "string" ) | ||
159 | $this->elem = gmp_init($_elem); | 163 | $this->elem = gmp_init($_elem); |
164 | else if( getType($_elem) == "integer" ) | ||
165 | $this->elem = gmp_init($_elem+0); | ||
166 | else if( getType($_elem) == "double" ) | ||
167 | $this->elem = gmp_init(intval($_elem)); | ||
160 | else | 168 | else |
161 | $this->elem = $_elem; | 169 | throw new Exception("Bad phpgats_Integer type: '" . |
170 | getType($_elem) . "'."); | ||
162 | } | 171 | } |
163 | 172 | ||
164 | function set( $_elem ) | 173 | function set( $_elem ) |