PHP Expressions

An expression is the basic building block of the language.
 Anything with a value can be thought of as an expression. 
Examples include:
5
5+5
$a
$a==5
sqrt(9)
By combining many of these basic expressions, you can
 build larger, more complex expressions.
Note that the echo statement we've used in numerous 
examples cannot be part of a complex expression because
 it does not have a return value. The print statement, on
 the other hand, can be used as part of complex expression
 -- it does have a return value. In all other respects, echo 
and print are identical: they output data.

Expressions are combined and manipulated using operators.

The control structures in PHP are very similar to those
 used by the C language. Control structures are used to 
control the logical flow through a PHP script. PHP's control 
structures have two syntaxes that can be used interchangeably. 
The first form uses C-style curly braces to enclose statement 
 blocks, while the second style uses a more verbose syntax 
that includes explicit ending statements. The first style is 
preferable when the control structure is completely within 
a PHP code block. The second style is useful when the 
construct spans a large section of intermixed code and 
HTML. The two styles are completely interchangeable, 
however, so it is really a matter of personal preference 
which one you use. 

The if statement is a standard conditional found in most languages.
 Here are the two syntaxes for the if statement:
if(expr) {            if(expr):
  statements            statements
} elseif(expr) {      elseif(expr):
  statements            statements
} else {              else:
  statements            statements
}                     endif;
The if statement causes particular code to be executed if
 the expression it acts on is true. With the first form, 
you can omit the braces if you only need to execute a 
single statement.


Related Posts:
  • Php-Associative Arrays Arrays are another basic structure in programming languages. Arrays provide means for storing a fixed set (or collection) of the same datatype in a convenient way, making each element of your set indexable by using a uniqu… Read More
  • PHP mail function  sendmail cofiguration in php.ini file  If the smtp server you're trying to relay the    email to requires you to authenticate mail() will fail. <?php // ---------------- SEND MAIL FORM -------------… Read More
  • Advanced PHP PHP's strength lies in its huge library of built-in functions, which allows even a novice user  to perform very complicated tasks without having to install new libraries or worry about low-level details, as is often th… Read More
  • Magic Methods-Php Php Mail Php Array Php If else Php Variable This is a link Php Substrings Php Sessions Magic Methods and Constants Magicmethods are specially named methods that can be defi nedin any class and … Read More
  • Php global variables Php Mail Php Array Php If else Php Variable This is a link Php Substrings Php Sessions Php global variables variables are automagically available in all contexts in function and global scopes. T… Read More
  • Php Form Example Since you'll need a place for the user to enter a search query, let's begin by building a form to handle the user's input. Every form must have these basic components:The submission type defined with the method keywordOne… Read More
  • Php HTTP Basics Php Web Application Php Email Codes Php Array Php Ifelse Php variables Php Substrings Php Mysql Functions php-sessions Php HTTP Basics When a web browser requests a web page, it sends an HTTP request… Read More
  • what is IMAP IMAP, fully documented in RFC 3501, was designed to provide a robust, mobile mail delivery and access mechanism. For more detail on the protocol and how it functions on the network layer, or for additional information on… Read More
  • Php file uploading code Php Mail Php Array Php If else Php Variable This is a link Php Substrings Php Sessions Php file uploading code To uploading a file, two changes must be made to the standard HTML form. First, the… Read More
  • Learn PhP By Code PHP - Echo example            <?php              $myString = "Hi! This is a test";         … Read More
  • Php for-web developers   PHP MySQL Functions Free Hosting Requiring Cookies Web Application with PHP php -Mail Functions PHP Array Substrings PHP Comparison Operators for If/Else Statements Showing the Browser and I… Read More
  • Php Code for a Valid Number Php Mail Php Array Php If else Php Variable This is a link Php Substrings Php Sessions Php Code for a Valid Number Besides working on numbers, is_numeric( ) can also be applied to numeric strings.… Read More
  • PHP's variable-related functions PHP's variable-related functions are a key part of the language. Skilled programmers rely on them extensively to build robust code that uses type-checking. Functions like var_dump() and print_r() are also invaluable w… Read More
  • Sends a message via mail function in PHP mail function allows you to send email directly from a PHP script. recipient can be  either a single email address or a comma-delimited list of addresses.  If you want to set extra headers—for instance, in order … Read More
  • mysql_query-executes query mysql_query function  executes query on the default database, set using mysql_select_db() or by a previous query using mysql_db_query(), on the MySQL server connection referenced by connection . If no connection … Read More