There are times when it’s convenient to be able to dynamically name and assign variables, but how do we go about doing so?
PHP syntax provides for the ability to do this with a feature called “variable variables.” A quick example is below.
Welcome to lesson 2 of this PHP lesson series. In this lesson
we will be covering basic logic and decision making structures of PHP.
Initially, this won’t make any sense, because we’re giving it the
variables it’ll use to make decisions, in the next full lesson, we’ll
actually have user input to look at, and that is where decision making
becomes very important, when acting on information provided by a user.
I’ll assume you’ve already got an acceptable place to try out PHP
scripts. Usually, you’ll do this on a web server. You can also install
a web server onto your own computer and PHP-enable it. Though, it is
possible to write command-line scripts with php as well. We’ll delve
into that in a later lesson. For now, we’ll focus on using PHP to
generate basic HTML pages and I’ll assume that you already know how to
put pages up for download and whatnot. Knowing HTML is fairly important if you wish to make it very far with web-based PHP.