Integer conversion for dummies
-
I'm successfully calling a mysql stored procedure using PDO with the following line:
$pdoCmd->fetch(PDO::FETCH_OBJ)
It returns an object that I need to get converted into an integer, seems straightforward enough but when the object is say "1000" and I cast to an int I get a value of 1. How can I convert an object to an integer and keep my zeroes?
-
I'm successfully calling a mysql stored procedure using PDO with the following line:
$pdoCmd->fetch(PDO::FETCH_OBJ)
It returns an object that I need to get converted into an integer, seems straightforward enough but when the object is say "1000" and I cast to an int I get a value of 1. How can I convert an object to an integer and keep my zeroes?
Think I figured it out:
$objResult = $pdoCmd->fetch(PDO::FETCH_OBJ);
$intValue = (int)$objResult->MyColumnName;Cheers