Saturday, January 13, 2018

PHP Expression

Expression


PopAds.net - The Best Popunder Adnetwork

Expressions in PHP (not regular expressions; they are a special case) are merely a collective term for code statements. 

$name = "Peter" ; 

That single code line is an assignment expression. It states, “assign the string value of Peter to the variable called $name .” Technically, the code line is a statement (the semicolon is the end-of-statement delimiter) composed of two expressions: 

The left side is an expression defining the storage and the right side is an expression defining the value to be assigned to the storage. The two expressions together form an assignment expression, and this is the complete statement.

 Note:-

 As a general rule, any assignment of a value is considered an expression, while statements are instructions.

 Other types of expressions include some functions and ternary if statements (explained in the next section on decision-making code). Functions that return a value are included, for instance. Here are two expression

 Examples:-


PHP Expression example

Function MyName is considered an expression since it returns a value, and the weird line of code after that assigns a value to $last based on the condition of the $name variable. We will look at more expressions throughout , but for now just be aware that expressions exist and that they are very common within PHP. Read More

0 comments:

Please comment and follow this site blog inbox