Re: [PHP] Array question

2010-09-25 Thread chris h
Mike, $results[] will automatically push a value unto the end of an array. So doing this... -- $magic = array(); $magic[] = 'a'; $magic[] = 'b'; $magic[] = 'c'; - is exactly this same as doing this... -- $normal = array(); $normal[0] = 'a'; $normal[1] = 'b'; $normal[2] = 'c'; -

[PHP] Array question

2010-09-25 Thread MikeB
I have the following code: $query = "SELECT * FROM classics"; $result = mysql_query($query); if (!$result) die ("Database access failed: " . mysql_error()); $rows = mysql_num_rows($result); for ($j = 0 ; $j < $rows ; ++$j) { $results[] = mysql_fetch_array($result); } mysql_close($db_server

RE: [PHP] if/elseif being treated as if/if

2010-09-25 Thread tedd
At 9:04 PM +0100 9/24/10, Ashley Sheridan wrote: I don't often use this type of logic, but I have used it before and it's served me well. Essentially, a switch is a glorified if statement, and I find them a lot nicer to read and write than a series of if/elseif blocks. Thanks, Ash Ash: Exa

RE: [PHP] if/elseif being treated as if/if

2010-09-25 Thread tedd
At 3:54 PM -0400 9/24/10, Bob McConnell wrote: From: tedd At 2:23 PM -0400 9/24/10, Bob McConnell wrote: >>A switch works when a single test can dispatch all possible branches. If you have a series of tests where each looks for a different subset of >>conditions, you need an elseif.

Re: [PHP] Re: Copying an Object

2010-09-25 Thread Daniel Kolbo
On 9/24/2010 9:49 AM, chris h wrote: > "Gang of Four" > > http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 > > An excellent book on OOP. > > Chris H. > > > On Fri, Sep 24, 2010 at 9:34 AM, Bob McConnell wrote: > >> From: chris h >> >>> On Fri, Sep 24, 201