Reply to Re: how do you pass a zero as a function argument?

Your name:

Reply:


Posted by Shelly on 10/01/07 18:50

"lawrence k" <lkrubner@geocities.com> wrote in message
news:1191264261.832485.249450@g4g2000hsf.googlegroups.com...
> 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?
>

Are you calling it with alphabeticalListOfAlbumsByLetter("0") or by
alphabeticalListOfAlbumsByLetter(0) ? If it works for "1", it should work
for "0". After all, what is being passed in is really only the ascii value
and the letters "1" and "0" both have ascii values.

Shelly

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация