chico1st Posted April 27, 2007 Share Posted April 27, 2007 Hi I was wondering how I can turn a string that is "05" into a string that is "5" Thanks Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 27, 2007 Share Posted April 27, 2007 $x = $x + 0; echo $x; Quote Link to comment Share on other sites More sharing options...
boo_lolly Posted April 27, 2007 Share Posted April 27, 2007 $x = $x + 0; echo $x; will this turn $x into an intiger or will it stay a string? why? Quote Link to comment Share on other sites More sharing options...
jitesh Posted April 27, 2007 Share Posted April 27, 2007 <?php echo "05"; echo "<br>"; echo (integer)("05"); ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted April 27, 2007 Share Posted April 27, 2007 var_dump($var) will tell you the type of a variables. Very handy for those type-related debugging sessions. Quote Link to comment Share on other sites More sharing options...
neel_basu Posted April 27, 2007 Share Posted April 27, 2007 $x = 05;//Here $x is Octal $x = 5;//Here $x is Int $x = "05";//Here $x is String $y = (integer)($x);//Now $y is int and is 5 echo gettype($y); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.