My PHP for beginners notes

19 March 2008

Disclaimer – there are likely to be mistakes in this, so please point them out! Here are my notes from my PHP for beginners course, which was excellent, and was run by Highlander. I know it’s better to use the PHP manual but it helps me to write these out so feel free to ignore these!

DAY 1

  • boolean = true or false
  • int = integer
  • float = fraction
  • string = text, in quotes
  • resource = external (not native to PHP) resource
  • $variablename

Associative arrays

  • $myArray = array (”keyname1″=>”value1″, “keyname2″ =>”value2″);
  • If no key name is provided, the default is 0, 1, 2… etc.
  • [square brackets are used to ACCESS array contents]
  • (normal brackets are used to SET UP functions and arrays)

HTML

<pre>
this will print on two
lines, even without a br tag
</pre>

Examples

$x = $x + 1;
//equals
x ++;

$n = 3;
echo $n * $n- -;

// (ignore spaces between minus symbols) equals
echo $n * ($n- -);

// two minus symbols after $n means run the line then apply (-1) to $n

$n = 3;
echo $n * – -$n;

// equals
– -$n;
echo $n*$n;

// two minus symbols before $n means apply (-1) to $n THEN run whole line.

(more…)

http://www.groupon.co.uk asks if you're a man or a married woman?pridebadge11pridebadge10pridebadge9pridebadge7pridebadge8Pride Badge 6Pride Badge 5
Powered by Wordpress   |   Lunated designed by ZenVerse