Php

Asked • 03/18/19

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 is there any similar method available in PHP? Input Output '2' 2 '2.34' 2.34 '0.3454545' 0.3454545

1 Expert Answer

By:

Madeny D. answered • 04/29/20

Tutor
New to Wyzant

Always learning or Teaching computer programming.

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.