Re: NULL expected, won't show up ...




ColdShine wrote:
frizzle in news:1142679430.087309.144470@xxxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:

Richard Levasseur wrote:
You can also just do == 0

"" == 0
NULL == 0
array() == 0
0 == 0

Coldshine's method is better though. If you require all the data, make
sure all of the parts have data in them.

Thank you both! So in fact it was ok to do my second option.
What i don't understand is the following:

echo '<br>year: '.($article_year? $article_year: 'null');
echo '<br>month: '.($article_month? $article_month: 'null');
echo '<br>article: '.($article_url? $article_url: 'null');

I know the statements, but what does it look for in this case?
Does it detect wether or not e.g. $article_year is set at all?

Sorry for my empty reply...
Anyways: if a variable is not set, casting it to bool (as done by testing
statements) will result in an E_NOTICE and will return false. Casting a 0 or
a null also return false.

--
ColdShine

"Experience is a hard teacher: she gives the test first, the lesson
afterwards." - Vernon Sanders law

ok, thank you!
I have it up and running now, and tested a lot, and it works great.
Thanks.

.



Relevant Pages

  • Re: NULL expected, wont show up ...
    ... if a variable is not set, casting it to bool (as done by testing ... "Experience is a hard teacher: she gives the test first, ...
    (comp.lang.php)
  • Re: strong/weak typing and pointers
    ... > Anything can be treated just as an array of bytes, ... For read-only-cases one might be able to ... allow access to the memory without opening the weak-typing loophole. ... firsthand, and whatever interpretation you impose on it by casting, there ...
    (comp.lang.python)
  • Re: Yet Another ClassCastException Question
    ... Mike> You didn't tell toArray what sort of array to create, ... Mike> created an Object. ... What am I missing about casting from Object ...
    (comp.lang.java.programmer)
  • Re: Yet Another ClassCastException Question
    ... clunky way of getting the dates into the ... Mike> You didn't tell toArray what sort of array to create, ... Mike> created an Object. ... What am I missing about casting from Object ...
    (comp.lang.java.programmer)
  • Re: Object Hash vs. object Array preference
    ... > will swallow any productivity difference advantages between of them? ... There is no casting anywhere. ... > gain for application I guess - if you manage to stay within Array only. ... If you just mean "string", ...
    (comp.lang.javascript)