adspace
Answer Posted / Asha Gupta
To convert a string to a number in PHP, you can use the `(int)`, `(float)`, or `(boolean)` casts. Here's an example for each method:n`n// Using (int)n$str = "123456";n$num = (int)$str;nn// Using (float)n$str = "123.456";n$num = (float)$str;nn// Using (boolean) (converts to 0 if the string is empty or contains non-numeric characters)n$str = "123abc";n$num = (boolean)$str;n`
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between htmlentities() and htmlspecialchars()?
What is difference between static and final in php?
hello all, I need some sample placement papers in lion bridge.. can anyone help me?
Tell me what kind of things have you done on the social side?
How to calculate the difference between two dates using php?
What is the current stable version of php?
how to detect a mobile device using php
How to create a web form?
What is the current stable version of php? What advance thing in php7?
Explain me is it possible to destroy a cookie?
Which variable declarations within a class is invalid in php?
What is trait in php?
Name and explain five of the PHP error constants?
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
sort term descripttion form, report and uery