In PHP, as in any other language, there are built in functions used to manipulate strings. Here are few of the most commonly used PHP functions for manipulating strings:
In PHP, variables can store data of different types. The following data types can be used in PHP:
- Resource (advanced topic)
In PHP the
print statements are two basic ways of getting output.
They both output data on the screen but there are three small differences between them.
echo statement has no return value while the
print statement has a return value of 1, so it can be used in expressions.
echo statement in PHP is a little bit faster than the
echo can take multiple parameters while the
print statement can take only one.
In PHP, variables start with
$ followed by the name of the variable. You don’t need any command or keyword for declaring variables in PHP.
Like in any other programming language, there are rules for declaring variables in PHP. Variables in PHP must start with a letter or an underscore sign. They can’t start with a number. A PHP variables can contain only letters, numbers and/or underscores (alphanumeric characters). They are also case sensitive.
$a = "Hi there!";
$A = 5;
$_ = 10.5;
$_a_b = "What a name!";
Although PHP is not the most powerful programming language, it is one of the most widely used for creating dynamic web pages. That’s because it is supported by most web hosting platforms (if not all). Here are the benefits of learning and using PHP for creating dynamic web pages.