PHP Syntax and other Notes

Note: this Scribble is buggy - the security filters are having a field day with the embedded PHP, expect missing keywords, etc.

function myPrint($value) {  echo "$value"; } 
array_walk($array, myPrint);

 


$str = <<

Example of string
spanning multiple lines
using heredoc syntax.

EOD;

 

$a & $b And Bits that are set in both $a and $b are set.
$a | $b Or Bits that are set in either $a or $b are set.
$a ^ $b Xor Bits that are set in $a or $b but not both are set.
~ $a Not Bits that are set in $a are not set, and vice versa.
$a << $b Shift left Shift the bits of $a $b steps to the left (each step means "multiply by two")
$a >> $b Shift right

Shift the bits of $a $b steps to the right (each step means "divide by two")

 

Modulus: $a % $b 

do {

$str2 = $str1;
$str1 = eregi_replace("(^| )(what|which|why|how|who|where|how|is|are|were|the|a|it|of|do|you|your|please|enter)[ ?]", " ", $str2);

} while ($str1 != $str2);

 

ini_set ( "max_execution_time", "240"); // MUST be larger than the timeout (in the source below)
ini_set ( "memory_limit", "130M");

 

tags: php, notes, syntax, examples, cheatsheet

Related Scribbles:
  • PEAR HTML_Template_IT - Simple PHP Templates Without Write Access
  • PHP - Use foreach on a two dimentional (or more) array.
  • PHP Array of Objects Example
  • php command line
  • PHP Curly Brackets in Strings
  • PHP left(), Right()
  • PHP Resources
  • PHP Security
  • Programming
  • Web Development Resources


  • ID: 102
    Author:
    leonard
    Date Updated:
    2019-02-16 13:34:11
    Date Created:
    2003-10-27 13:02:04

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> PHP Syntax and other Notes
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.