Skip to main content
Question Protected by CommunityBot
removed pointless wikipedia link, fixed JavaScript-related stuff
Source Link
Mark Amery
  • 158.3k
  • 93
  • 435
  • 476

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use numberNumber(), but areis there any similar method available in PHP (general solution)PHP?

Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use number(), but are there any similar method available in PHP (general solution)?

Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use Number(), but is there any similar method available in PHP?

Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545
Copy edited.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

PHP: How todo I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use number(), but in php are there any similar method available in PHP (general solutiongeneral solution)?


Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545
Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545

PHP: How to convert string to number?

I want to convert these types of values '3', '2.34', '0.234343' etc. to a number. In JavaScript we can use number(), but in php are there any similar method available (general solution)?


Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545

How do I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a number. In JavaScript we can use number(), but are there any similar method available in PHP (general solution)?

Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545
edited tags; edited title
Link
Eric Leschinski
  • 155.3k
  • 96
  • 423
  • 337
Loading
formatting
Source Link
GSerg
  • 78.8k
  • 18
  • 173
  • 377
Loading
edited tags
Link
hakre
  • 199.8k
  • 55
  • 454
  • 865
Loading
added 22 characters in body
Source Link
Sara
  • 14.7k
  • 13
  • 37
  • 50
Loading
added 120 characters in body
Source Link
Sara
  • 14.7k
  • 13
  • 37
  • 50
Loading
Source Link
Sara
  • 14.7k
  • 13
  • 37
  • 50
Loading