kyote scribbled something along the lines of:
[color=blue]
> This is straight out of a book I'm reading to learn PHP. I'm thinking
> maybe I set either apache or PHP up incorrectly on my computer.
> Simpler PHP's snippets work fine so I just don't know. Could someone
> look this over and see if I have a problem?
>
>
>
> <?php
> function printColor($text,
> $color="black", &$count=NULL)
> {
> //print the text with style
> print("<span style=\"color: $color\">" .
> "$text</span>");
>
> //if given a count, increment it
> if(isset($count))
> {
> $count++;
> }
> }
>
> //call with one argument
> printColor("This is black text");
> print("<br>\n");
>
> //override default color
> printColor("This is blue text", "blue");
> print("<br>\n");
>
> //pass in count reference
> $c = 0;
> printColor("This is red text", "red", $c);
> print("<br>\n");
> printColor("This is green text", "green", $c);
> print("<br>\n");
> print("Count: $c<br>");
> ?>[/color]
You do not want that functionality. You want to manipulate a global
variable instead. Look up globals and how to manipulate them from within
a function at
http://www.php.net/manual please.
Instead of passing the count variable you'll more likely want to pass a
boolean (whether you want the call to count or not: TRUE or FALSE
respectively with the default in the function being FALSE).
--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/