I know it's definitlyy possible to do this.
I have a string that contains a number I want to convert it from a string to a number.
I've done this in javascript with parseInt/parseFloat.
Can anyone tell me the syntax to do that?
Thanks
Converting a number string to a number - Noob Question
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
You can type cast it also...
Code: Select all
<?php
$mystring = '4.54';
$myint = (int) $mystring;
?>