Showing posts with label The. Show all posts
Showing posts with label The. Show all posts

Friday, October 1, 2010

The Concatenation Operator in Php

The concatenation operator is a single dot. Treating both operands as strings, it
appends the right-hand operand to the left. So
"hello"." world"
returns
"hello world"
Regardless of the data types of the operands, they are treated as strings, and the
result always is a string.

The Assignment Operator in Php

You have met the assignment operator each time we have initialized a variable. It
consists of the single character =. The assignment operator takes the value of its
right-hand operand and assigns it to its left-hand operand:
$name ="matt";
The variable $name now contains the string "matt". Interestingly, this construct is
an expression. It might look at first glance that the assignment operator simply
changes the variable $name without producing a value, but in fact, a statement that
uses the assignment operator always resolves to a copy of the value of the right
operand. Thus
print ( $name = "matt" );
prints the string "matt" to the browser in addition to assigning "matt" to $name.
Arithmetic Operators

Monday, September 27, 2010

The print() Function

print() is a function that outputs data. In most cases, anything output by print()
ends up in the browser window. A function is a command that performs an action,
usually modified in some way by data provided for it. Data sent to a function is
almost always placed in parentheses after the function name. In this case, you sent
the print() function a collection of characters, or string. Strings must always be
enclosed by quotation marks, either single or double.

Note: Function calls generally require parentheses after their name whether or
not they demand that data be passed to them. print() is an exception,
and enclosing the data you want to print to the browser in parentheses is
optional. This is the more common syntax, so we will usually omit the
brackets in our examples.
You ended your only line of code in Listing 3.1 with a semicolon. The semicolon
informs the interpreter that you have completed a statement.

NEW TERM
A statement represents an instruction to the interpreter. Broadly, it
is to PHP what a sentence is to written or spoken English. A
statement should usually end with a semicolon; a sentence should
end with a period. Exceptions to this include statements that
enclose other statements, and statements that end a block of code.
In most cases, however, failure to end a statement with a semicolon
will confuse the interpreter and result in an error.
Because the statement in Listing 3.1 is the final one in that block of code, the
semicolon is optional.

The Zend Engine in Php

When PHP3 was written, an entirely new parser was created from the ground up.
PHP4 represents a similar change to the scripting engine. This rewrite, though, is
more significant by orders of magnitude.Zend is a scripting engine that sits below the PHP-specific modules. It is optimized
to significantly improve performance.
These changes in efficiency will ensure PHP4's continued success. Most code written
for PHP3 will continue to run with no changes; however, these scripts may run up to
200 times faster!
A commercial addition to the Zend engine will be the facility for compiling PHP
scripts. This will provide a further gain in performance that should leave most, if not
all, competitors far behind.
Zend is built to improve performance but is also designed for increased flexibility.
Communication with servers has been improved, so it will be possible to create PHP
modules that work with a wider range of servers. Unlike a CGI interpreter, which sits
outside a server and is initialized every time a script is run, a server module runs in
conjunction with the server. This improves performance because the scripting
engine does not need to be started for a PHP page to be executed.