PHP 5 Operators

PHP Operators Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators Comparison operators Increment/Decrement operators Logical operators String operators Array operators PHP Arithmetic Operators The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, […]

PHP 5 Constants

PHP 5 Constants Constants are like variables except that once they are defined they cannot be changed or undefined. PHP Constants A constant is an identifier (name) for a simple value. The value cannot be changed during the script. A valid constant name starts with a letter or underscore (no $ sign before the constant name). […]

PHP 5 Strings

PHP 5 Strings A string is a sequence of characters, like “Hello world!”. PHP String Functions In this chapter we will look at some commonly used functions to manipulate strings. Get The Length of a String The PHP strlen() function returns the length of a string. The example below returns the length of the string “Hello world!”: Example […]

PHP Data Types

PHP Data Types Variables can store data of different types, and different data types can do different things. PHP supports the following data types: String Integer Float (floating point numbers – also called double) Boolean Array Object NULL Resource PHP String A string is a sequence of characters, like “Hello world!”. A string can be […]

PHP 5 echo and print Statements

PHP 5 echo and print Statements In PHP there are two basic ways to get output: echo and print. In this tutorial we use echo (and print) in almost every example. So, this chapter contains a little more info about those two output statements. PHP echo and print Statements echo and print are more or less the same. They are both used to output data […]

PHP 5 Variables

PHP 5 Variables Variables are “containers” for storing information. Creating (Declaring) PHP Variables In PHP, a variable starts with the $ sign, followed by the name of the variable: Example <?php $txt = “Hello world!”; $x = 5; $y = 10.5; ?> Output Variables The PHP echo statement is often used to output data to the screen. The following example […]

PHP 5 Syntax

PHP 5 Syntax A PHP script is executed on the server, and the plain HTML result is sent back to the browser. Basic PHP Syntax A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>: <?php // PHP code goes here ?> The default file […]

Enjoy this blog? Please spread the word :)