From the course: PHP for Web Designers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using functions to manipulate values - PHP Tutorial
From the course: PHP for Web Designers
Using functions to manipulate values
Often, the values stored in the database or submitted through an online form, aren't in the right format. PHP provides a huge number of built in functions that allow you to manipulate string values. As a simple example, let's use a function to convert a string to uppercase. In the file that I've got open, above the doc type, I've created a variable called city and I've assigned it the value, London. And in the HTML down below, I've got 3 paragraphs with PHP blocks that use echo to display the value of city. And in this second paragraph, I want to convert the value of city. To uppercase. I'm going to do that using a built in PHP function that has a rather unpronounceable name, str2upper. It makes a bit more sense when you realize that the str at the beginning stands for string. So it's string to upper, or string to upper case. I'll call it string to upper to make it easier to pronounce. So to convert city to upper case, I need to pass city as an argument to string to upper. The way I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
How PHP makes web pages dynamic5m 23s
-
(Locked)
How to use PHP in a web page6m 43s
-
(Locked)
Using variables to store information2m 52s
-
(Locked)
Storing numbers and text in variables5m 18s
-
(Locked)
Displaying the values of number and text variables8m 9s
-
(Locked)
Using functions to manipulate values4m 36s
-
(Locked)
Adding comments to PHP scripts4m 46s
-
-
-
-
-
-
-
-