|
Posted by ZeldorBlat on 10/01/07 18:51
On Oct 1, 2:44 pm, lawrence k <lkrub...@geocities.com> wrote:
> I've got a function that starts off like this:
>
> function alphabeticalListOfAlbumsByLetter($whichLetter="a") {
>
> }
>
> I pass in the letters (a, b, c, d, etc) and the numbers (0, 1, 2, 3,
> 4, etc). It finds in the database records starting with that letter or
> number. It works fine except when I try to pass in a zero. The PHP
> code acts as if I have not passed in a function argument, so
> $whichLetter becomes "a", which is the default value (as you can
> see).
>
> So how do I get PHP to see that I'm really passing in a zero, and not
> just some false value?
The problem is likely elsewhere in your code. The following correctly
outputs "0" for me:
<?php
function alphabeticalListOfAlbumsByLetter($whichLetter="a") {
echo $whichLetter;
}
alphabeticalListOfAlbumsByLetter(0);
?>
[Back to original message]
|