To supresses error reporting.
Sometmes functions are called with “@’ in front of them -
E.g. $somevar = @mail($to,$subject,$msg);
To supresses error reporting.
Sometmes functions are called with “@’ in front of them -
E.g. $somevar = @mail($to,$subject,$msg);
/[a-z]/i
#[a-z]#i
%[a-z]%i

/[a-z]/i
#[a-z]#i
%[a-z]%i

from: http://docs.joomla.org/Sql_parameter_type
from: http://docs.joomla.org/Sql_parameter_type
http://dev.mysql.com/doc/refman/5.0/en/outer-join-simplification.html
===========
mysql> SELECT cds.artist, cds.title, genres.genre
-> FROM cds, genres
-> WHERE (cds.genreID = genres.genreID);
When a string is specified in double quotes or with heredoc,
variables are parsed within it.
There are two types of syntax: a
simple one and a
complex one.
The simple syntax is the most common and convenient. It provides a way to
embed a variable, an array value, or an object
property in a string with a minimum of effort.
The complex syntax was introduced in PHP 4, and can be recognised by the
curly braces surrounding the expression.
If a dollar sign ($) is encountered, the parser will
greedily take as many tokens as possible to form a valid variable name.
Enclose the variable name in curly braces to explicitly specify the end of
the name.
<?php
$beer = 'Heineken';
echo "$beer's taste is great"; // works; "'" is an invalid character for variable names
echo "He drank some $beers"; // won't work; 's' is a valid character for variable names but the variable is "$beer"
echo "He drank some ${beer}s"; // works
echo "He drank some {$beer}s"; // works
?>
Similarly, an array index or an object property
can be parsed. With array indices, the closing square bracket
(]) marks the end of the index. The same rules apply to
object properties as to simple variables.
<?php
// These examples are specific to using arrays inside of strings.
// When outside of a string, always quote array string keys and do not use
// {braces}.
// Show all errors
error_reporting(E_ALL);
$fruits = array('strawberry' => 'red', 'banana' => 'yellow');
// Works, but note that this works differently outside a string
echo "A banana is $fruits[banana].";
// Works
echo "A banana is {$fruits['banana']}.";
// Works, but PHP looks for a constant named banana first, as described below.
echo "A banana is {$fruits[banana]}.";
// Won't work, use braces. This results in a parse error.
echo "A banana is $fruits['banana'].";
// Works
echo "A banana is " . $fruits['banana'] . ".";
// Works
echo "This square is $square->width meters broad.";
// Won't work. For a solution, see the complex syntax.
echo "This square is $square->width00 centimeters broad.";
?>
For anything more complex, you should use the complex syntax.
When a string is specified in double quotes or with heredoc,
variables are parsed within it.
There are two types of syntax: a
simple one and a
complex one.
The simple syntax is the most common and convenient. It provides a way to
embed a variable, an array value, or an object
property in a string with a minimum of effort.
The complex syntax was introduced in PHP 4, and can be recognised by the
curly braces surrounding the expression.
If a dollar sign ($) is encountered, the parser will
greedily take as many tokens as possible to form a valid variable name.
Enclose the variable name in curly braces to explicitly specify the end of
the name.
<?php
$beer = 'Heineken';
echo "$beer's taste is great"; // works; "'" is an invalid character for variable names
echo "He drank some $beers"; // won't work; 's' is a valid character for variable names but the variable is "$beer"
echo "He drank some ${beer}s"; // works
echo "He drank some {$beer}s"; // works
?>
Similarly, an array index or an object property
can be parsed. With array indices, the closing square bracket
(]) marks the end of the index. The same rules apply to
object properties as to simple variables.
<?php
// These examples are specific to using arrays inside of strings.
// When outside of a string, always quote array string keys and do not use
// {braces}.
// Show all errors
error_reporting(E_ALL);
$fruits = array('strawberry' => 'red', 'banana' => 'yellow');
// Works, but note that this works differently outside a string
echo "A banana is $fruits[banana].";
// Works
echo "A banana is {$fruits['banana']}.";
// Works, but PHP looks for a constant named banana first, as described below.
echo "A banana is {$fruits[banana]}.";
// Won't work, use braces. This results in a parse error.
echo "A banana is $fruits['banana'].";
// Works
echo "A banana is " . $fruits['banana'] . ".";
// Works
echo "This square is $square->width meters broad.";
// Won't work. For a solution, see the complex syntax.
echo "This square is $square->width00 centimeters broad.";
?>
For anything more complex, you should use the complex syntax.
Example #1 References and Objects
<?php
class A {
public $foo = 1;
}
$a = new A;
$b = $a; // $a and $b are copies of the same identifier
// ($a) = ($b) = <id>
$b->foo = 2;
echo $a->foo."\n";
$c = new A;
$d = &$c; // $c and $d are references
// ($c,$d) = <id>
$d->foo = 2;
echo $c->foo."\n";
$e = new A;
function
foo($obj) {
// ($obj) = ($e) = <id>
$obj->foo = 2;
}
foo($e);
echo $e->foo."\n";
?>
The above example will output:
2<br />2<br />2<br />
Example #1 References and Objects
<?php
class A {
public $foo = 1;
}
$a = new A;
$b = $a; // $a and $b are copies of the same identifier
// ($a) = ($b) = <id>
$b->foo = 2;
echo $a->foo."\n";
$c = new A;
$d = &$c; // $c and $d are references
// ($c,$d) = <id>
$d->foo = 2;
echo $c->foo."\n";
$e = new A;
function
foo($obj) {
// ($obj) = ($e) = <id>
$obj->foo = 2;
}
foo($e);
echo $e->foo."\n";
?>
The above example will output:
2<br />2<br />2<br />
Example #1 Ejemplo de array()
<?php
$frutas = array (
"frutas" => array("a"=>"naranja", "b"=>"plátano", "c"=>"manzana"),
"números" => array(1, 2, 3, 4, 5, 6),
"hoyos" => array("primero", 5 => "segundo", "tercero")
);
?>
Example #2 Índice automático con array()
<?php
$array = array(1, 1, 1, 1, 1, 8 => 1, 4 => 1, 19, 3 => 13);
print_r($array);
?>
El resultado del ejemplo seria:
Array<br />(<br /> [0] => 1<br /> [1] => 1<br /> [2] => 1<br /> [3] => 13<br /> [4] => 1<br /> [8] => 1<br /> [9] => 19<br />)<br />
Example #1 Ejemplo de array()
<?php
$frutas = array (
"frutas" => array("a"=>"naranja", "b"=>"plátano", "c"=>"manzana"),
"números" => array(1, 2, 3, 4, 5, 6),
"hoyos" => array("primero", 5 => "segundo", "tercero")
);
?>
Example #2 Índice automático con array()
<?php
$array = array(1, 1, 1, 1, 1, 8 => 1, 4 => 1, 19, 3 => 13);
print_r($array);
?>
El resultado del ejemplo seria:
Array<br />(<br /> [0] => 1<br /> [1] => 1<br /> [2] => 1<br /> [3] => 13<br /> [4] => 1<br /> [8] => 1<br /> [9] => 19<br />)<br />
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in
simpler terms, the double colon, is a token that allows access to
static,
constant, and overridden
members or methods of a class.
When referencing these items from outside the class definition, use
the name of the class.
Example #1 :: from outside the class definition
<?php
class MyClass {
const CONST_VALUE = 'A constant value';
}
$classname = 'MyClass';
echo $classname::CONST_VALUE; // As of PHP 5.3.0
echo MyClass::CONST_VALUE;
?>
And, Static properties cannot be accessed through the object using the arrow
operator ->.
http://uk2.php.net/language.oop5.static
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in
simpler terms, the double colon, is a token that allows access to
static,
constant, and overridden
members or methods of a class.
When referencing these items from outside the class definition, use
the name of the class.
Example #1 :: from outside the class definition
<?php
class MyClass {
const CONST_VALUE = 'A constant value';
}
$classname = 'MyClass';
echo $classname::CONST_VALUE; // As of PHP 5.3.0
echo MyClass::CONST_VALUE;
?>
And, Static properties cannot be accessed through the object using the arrow
operator ->.
http://uk2.php.net/language.oop5.static
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in
simpler terms, the double colon, is a token that allows access to
static,
constant, and overridden
members or methods of a class.
When referencing these items from outside the class definition, use
the name of the class.
Example #1 :: from outside the class definition
<?php
class MyClass {
const CONST_VALUE = 'A constant value';
}
$classname = 'MyClass';
echo $classname::CONST_VALUE; // As of PHP 5.3.0
echo MyClass::CONST_VALUE;
?>
And, Static properties cannot be accessed through the object using the arrow
operator ->.
http://uk2.php.net/language.oop5.static
For example ‘2%’ would match the following: 20, 25, 2000000, 2avkldj3jklsaf, and 2!
$result = mysql_query(“SELECT * FROM example WHERE age LIKE ‘2%’ “)
or die(mysql_error());
$a=10 ; //(1010b)
$b = 0; // (0000b)
if ($a & $b)
is different from
if ($a && $b)
The first one is true and the second if false.
When
we use only one & it means bit-by-bit and operation, so $a &
$b=10 (1010b), while when you use && it means and operator of
clauses and in this case $a && $b = 0, cause $b=0.
Beware of the signs. This FAQ is also valid for the or operator (‘|’).
$a=10 ; //(1010b)
$b = 0; // (0000b)
if ($a & $b)
is different from
if ($a && $b)
The first one is true and the second if false.
When
we use only one & it means bit-by-bit and operation, so $a &
$b=10 (1010b), while when you use && it means and operator of
clauses and in this case $a && $b = 0, cause $b=0.
Beware of the signs. This FAQ is also valid for the or operator (‘|’).
$a=10 ; //(1010b)
$b = 0; // (0000b)
if ($a & $b)
is different from
if ($a && $b)
The first one is true and the second if false.
When
we use only one & it means bit-by-bit and operation, so $a &
$b=10 (1010b), while when you use && it means and operator of
clauses and in this case $a && $b = 0, cause $b=0.
Beware of the signs. This FAQ is also valid for the or operator (‘|’).