note 55696 deleted from ref.strings by nlopess

From: Date: Thu, 11 Aug 2005 11:38:47 +0000
Subject: note 55696 deleted from ref.strings by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93425@lists.php.net to get a copy of this message
Note Submitter: asheem g Reason: useless ---- Was trying to convert string to integer. function stringToint($str) { $num =0; for($i=0; $i<strlen($str); $i++) { $var = $str[$i]; $new_pow = strlen($str)-1-$i; switch($var) { case($var=="0"): $num += 0*pow(10,$new_pow); break; case($var=="1"): $num += 1*pow(10,$new_pow); break; case($var=="2"): $num += 2*pow(10,$new_pow); break; case($var=="3"): $num += 3*pow(10,$new_pow); break; case($var=="4"): $num += 4*pow(10,$new_pow); break; case($var=="5"): $num += 5*pow(10,$new_pow); break; case($var=="6"): $num += 6*pow(10,$new_pow); break; case($var=="7"): $num += 7*pow(10,$new_pow); break; case($var=="8"): $num += 8*pow(10,$new_pow); break; case($var=="9"): $num += 9*pow(10,$new_pow); break; } } return $num; }

« previous php.notes (#93425) next »