29 if ($number ===
'')
return false;
30 if ($number ===
'0')
return '0';
35 if ($this->non_negative)
return false;
38 $number = substr($number, 1);
41 if (ctype_digit($number)) {
42 $number = ltrim($number,
'0');
43 return $number ? $sign . $number :
'0';
47 if (strpos($number,
'.') ===
false)
return false;
49 list($left, $right) = explode(
'.', $number, 2);
51 if ($left ===
'' && $right ===
'')
return false;
52 if ($left !==
'' && !ctype_digit($left))
return false;
54 $left = ltrim($left,
'0');
55 $right = rtrim($right,
'0');
58 return $left ? $sign . $left :
'0';
59 }
elseif (!ctype_digit($right)) {
63 return $sign . $left .
'.' . $right;