# tianjara.net | Andrew Harvey's Blog

COMP3311 - Week 7 Notes
5th May 2009

Its pointless repeating what John put in the lecture slides, so this is just my additions that he mentioned but are not in the slides.

## Aggregates

Initial condition is defaulted to NULL. So sometimes you will need to define,

  initcond = '';

This is different to NULL, because,

  null || 'abc' --> null

(where || is append) but

  '' || 'abc' --> 'abc'

## PHP

$x = 2; myFunc() { global$x;
}

If we omit the global $x, then any references to$x in myFunc will refer to a new local x, not the first x that is set to 2. To avoid this and force any references to x inside myFunc to refer to the first x that is equal to 2, we need this global $x line. ## strpos 1.$i = strpos('abc', 'a') --> 0
2. $i = strpos('abc', 'b') --> 1 3.$i = strpos('abc', 'z') --> false

if($i) will only be true in case 2 (false in case 1 and 3). So if we want to test if the second string was at all in the first string we must use, if($i !== false)

This one will be true in case 1 and 2, but not 3.

Tags: comp3311, computing.