On 7/14/2011 7:44 PM, Daevid Vincent wrote:
Ah! Thanks Simon! That is exactly right. Doh! I should have thought of
that... *smacks head*
Here is the fruit of my labor (and your fix)...
/**
* Useful for debugging functions to see parameter names, etc.
* Based upon
Can someone double check me here, but I think I found a bug...
?php
/*
$ php -v
PHP 5.3.6 with Suhosin-Patch (cli) (built: Apr 28 2011 14:20:48)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.0.5, Copyright (c) 2002-2008, by
On 15/07/2011, at 1:58 PM, Daevid Vincent wrote:
function test($v)
{
var_dump($v);
if (is_string($v)) echo FOUND A STRING.\n;
if (is_null($v)) echo FOUND A NULL.\n;
switch ($v)
{
case is_string($v):
echo I think v is a
-Original Message-
From: Simon J Welsh [mailto:si...@welsh.co.nz]
Sent: Thursday, July 14, 2011 7:29 PM
To: Daevid Vincent
Cc: php-general@lists.php.net
Subject: Re: [PHP] is_null() and is_string() reversed when using in switch
case statements...
On 15/07/2011, at 1:58 PM, Daevid
Hi Everyone,
Here's my problem: I'd like to make the printing of some text dependent on
whether or not a variable is null. In the following example, when $row[1]
is null, what gets printed on the page is Email: . I'd like the
script to not print Email: if row[1] is null.
It looks like I
You can use:
if($row[1]){print Email:$row[1];}else{print ;}
Jason White
- Original Message -
From: Matthew K. Gold [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 12, 2002 9:23 PM
Subject: [PHP] is_null question
Hi Everyone,
Here's my problem: I'd like to make
- Original Message -
From: Jason White [EMAIL PROTECTED]
To: Matthew K. Gold [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, July 12, 2002 9:28 PM
Subject: Re: [PHP] is_null question
You can use:
if($row[1]){print Email:$row[1];}else{print ;}
Jason White
- Original Message
I need to check variables for blank values but it appears that is_null and
== return true if there is a space.
Any other suggestions?
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To
Ahh...
and the winner is empty().
Thanks Christian for this elusive answer and everyone else for their input.
Spunk
I need to check variables for blank values but it appears that is_null and
== return true if there is a space.
Any other suggestions?
Thanks
--
PHP General
I wanted to use is_null, but it isn't available in my version
(4.0B2)
What would be an equivalent? I'm fairly new to PHP.
I was using isset, but sometimes it is set to Null.
Null values are unacceptable, but zero is a perfectly acceptable
value for what I want.
Jennifer
--
PHP General
It's supported from 4.0.4, I think.
Regards,
--
Yasuo Ohgaki
"Jennifer" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I wanted to use is_null, but it isn't available in my version
(4.0B2)
What would be an equivalent? I'm fairly new to PHP.
I was using
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jennifer)
wrote:
I wanted to use is_null, but it isn't available in my version
(4.0B2)
What would be an equivalent? I'm fairly new to PHP.
I was using isset, but sometimes it is set to Null.
Null values are unacceptable, but zero is a
It doesn't tell you if a variable is actually null, but unless you
specifically need to know if it is actually "NULL", just testing for truth
is usually enough.
For most uses it works fine, but if you really need to know wether or not
it's null, take one of the other suggestions.
For instance,
13 matches
Mail list logo