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

String Functions

A lot of functions can enhance a string’s capabilities. One very common need is to convert an integer into a string. This may happen when you take in an integer from a form and need to add it to part of a string. Fortunately, there is a function that can do this: strval(). Let’s put this in a quick program. Watch what happens if we have the user enter two numbers. The program adds them together and combines the results of strval(). The first page is a simple HTML page. The following code creates a page that looks like Figure 8.8:

Figure 8.8. The phpft08-03.html file.

<!DOCTYPE html PUBLIC "-//W3C//DTD ...

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