not exactly annoyances but rather programming techniques that are very cleverly hidden or outright missing in various manuals and due to special characters impossible to search for in google. probably considered such basics that everyday language users cant imagine someone not knowing them and frown upon the asker. for someone like me who jumps from language to language and back and has to constantly look up the ONLY CORRECT RIGID SYNTAX again and again these appear to be a nightmare to find
oh and this page is just for me - to look up what i keep forgetting... so if you have a comment keep it to yourself

HTML : what were those html tags that I constantly need to use but never seem to remember
PHP : assignment operators
PHP : variable name in variable

HTML : what were those html tags that I constantly need to use but never seem to remember
<DL> <DT> <DD> - definition list, <PRE> - preformatted text, <UL> - unordered list
<DL>
  <DT>term</DT>
  <DD>definition of the term</DD>
</DL>
  
term
definition of the term
<PRE>
this text is in monospaced font
   and it preserves spaces
      and     line
         breaks
</PRE>
  
this text is in monospaced font
   and it preserves spaces
      and     line
         breaks
    
<UL>
  <LI>Item 1</LI>
  <LI>Item 2</LI>
</UL>
  
  • Item 1
  • Item 2
PHP : assignment operators
bitwise shift in for loop

$a = 1;    $a += 1;    // $a is 2    - addition
$a = 2;    $a *= 2;    // $a is 4    - multiplication
$a = 1;    $a <<= 1;   // $a is 2    - bitwise shift left
$a = 2;    $a >>= 1;   // $a is 1    - bitwise shift right
$a = 0x05; $a &= 0x0A; // $a is 0    - bitwise and
$a = 0x05; $a |= 0x0A; // $a is 15   - bitwise or
$a = 0x0F; $a ^= 0x03; // $a is 12   - bitwise xor
$a = 'a';  $a .= 'b';  // $a is 'ab' - concatenation

// example of bitwise shift left in for loop
// count set bits in $c
$c = 0x0F;
for($b = 1, $a = 0; $b <= 0x08; $b <<= 1){
  if($c & $b){$a++;}
}
// $a is 4

PHP : variable name in variable or
variable name in array, variable name in 2D array, array name in variable, array name in array, array name in 2D array, 2D array name in variable, 2D array name in array, 2D array name in 2D array, function name in variable, function name in array, function name in 2D array
// sample 1 - array name in variable
$a = array('1', '2', '3', '4');
$b = 'a';

echo count($$b) . "<br />\n"; // outputs 4


// sample 2 - array name in 2D array
$a = array('1', '2', '3', '4');
$b = array(
  0 => array(0 => 'x', 1 => 'a', 2 => 'x'),
  1 => array(0 => 'x', 1 => 'x')
);

echo count($$b[0][1]) . "<br />\n"; // outputs 4


// sample 3 - 2D array name in 2D array
//   in come the magic curly brackets
$a = array(
  'c' => array('1', '2', '3', '4'),
  'd' => array('5', '6', '7')
);
$b = array(
  0 => array(0 => 'x', 1 => 'a', 2 => 'x'),
  1 => array(0 => 'x', 1 => 'x')
);

echo count(${$b[0][1]}['c']) . "<br />\n"; // outputs 4
echo ${$b[0][1]}['c'][1] . "<br />\n"; // outputs 2


// sample 4 - function name in 2D array
function function_c() {
  echo "uga buga<br />\n";
}

$a = array(
  'c' => array('function_c', '1', '2', '3'),
  'd' => array('function_d', '4', '5')
);

if (function_exists($a['c'][0])) {
  $a['c'][0]();
}