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…)

Doodle gender options include 'other'#readinglist #igersbrighton #books #socialism #feminism #religion #politicsMe when I was four again, close up #1986 in grandad's flat capThis is me in about #1986 in my grandad's flat cap, hanging out of the car window looking cool, pouting for the camera. I love my shirt in this! Also apparently I didn't like wearing trousers much!!This is my back garden. Yes it is huge! Around 80ft by 30ft.This is a piece of the #brighton west pier that I collected from the beach when it burnt. I took the photo from the newspaper. #igersbrightonWelcome to #brooklyn #nyc#stonewall #nyc #lgbtq #queer
Powered by Wordpress   |   Lunated designed by ZenVerse