O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calling a Function Depending on a Condition

Sometimes you need to call a function depending on a condition. You’ll often need to write more than one function in a program. We don’t need to call all of them in every run, but we may need to call a few depending on the situation.

One of the best examples is when you need to convert Celsius to Fahrenheit or vice versa: a degree-conversion calculator. The first thing to do is design the HTML page. This is going to be complex because it gives the user lots of options to convert. Let’s take a look at the HTML file it takes to produce this. You can find this on the CD as phpft09-04.html.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required