List ALL kinds of symbols in PHP (awesomely comprehensive!!)
Setting variable:
if (!isset($myvar)) $myvar = 'joe'; and other ways
Creating an associative array: $massiiv[] = array();
++$i pre-increment
$i++ post-increment
echo nl2br ("some \n text") linebreak in echo
& before a variable/argument as in someFunction(&$argument) is a reference to the original (not copy)(any manipulation of the variable will affect the original)
function foo(&$bar) {
$bar = 1;
}
$x = 0;
foo($x);
echo $x; //returns 1
$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'] should show the complete path
(int) in front of a variable tries to convert it to an integer eg echo (int) $var
foreach($responsibilities as $i => $resp) {
$resp = preg_replace(
$patterns = array('/^(\d\.\s(?!aastane)|(\*)+\s*|\t|-|\s*)|\s$/', '/(?<!:|\.)\s*$/'),
$replace = array('','.'),
$resp
);
//is the same as
$resp = preg_replace('/^(\d\.\s(?!aastane)|(\*)+\s*|\t|-|\s*)|\s$/','',$resp);
//and
$resp = preg_replace('/(?<!:|\.)\s*$/','.',$resp);
}
Boolean operator || returns boolean value
If an operand evaluates to false, subsequent operands are skipped, eg false && foo() never gets to foo()
Binary (bitwise) operator | returns numerical or alphabetic value
Operand is converted into and evaluated in binary system but returned in decimal
All operands are checked, eg false & foo() also evaluates foo()
14 & 7 /*returns 6*/ 7 | 25 & 8 /*returns 15*/
7 = 00111
14 = 1110 25 = 11001
7 = 0111 8 = 01000
--------- ----------
0110 = 6 in dec (01000) 25 & 8
01111 = 15 in dec
for words:
"tere" | "tee" /*returns tewe*/ "tere" & "tee" /*returns te` */
tere 01110100 01100101 01110010 01100101 01110100 01100101 01110010 01100101
tee 01110100 01100101 01100101 00100000 for space 01110100 01100101 01100101 00100000
----------------------------------- -----------------------------------
TF value 01110100 01100101 01110111 01100101 = tewe 01110100 01100101 01100000 00100000