#18223 [Opn->Bgs]: Extended ease of if () / elseif () and is_null() bug (?)
| From: | helly@php.net | Date: | Sat, 26 Apr 2003 14:38:58 +0000 |
| Subject: | #18223 [Opn->Bgs]: Extended ease of if () / elseif () and is_null() bug (?) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38449@lists.php.net to get a copy of this message | ||
ID: 18223
Updated by: helly@php.net
Reported By: GrimZ at php-freaks dot org
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Windows 2k / Linux / FreeBSD
PHP Version: 4.2.1
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Solve this with php. No support will be done ever at language level.
Previous Comments:
------------------------------------------------------------------------
[2002-07-08 07:41:16] GrimZ at php-freaks dot org
It would be great if there was some method of PHP storing the last
matched if condition. Allow me to demonstrate.
; --- Example
$myarray = array(
'this' => 'test',
'that' => 'fun',
);
if ($myarray['this'] == 'test')
{
echo('The value is '.$myarray['this']);
}
Now, I'm suggesting something like $ifmatch (easy name) and it would
work like so.
$ifmatch retains the first condition of an if () / elseif() that has
matched (it's TRUE) like so:
if ($myarray['this'] == 'test')
{
echo('The value is '.$ifmatch);
}
Where $ifmatch = 'test' (or, $array['this'] if you prefer)
You might wonder what the advantage is? Well, I think it's a lot easier
and more functional to do this:
if ($myarray['this'] == 'test')
{
echo('The value is '.$ifmatch);
}
Then:
if ($myarray['this'] == 'test')
{
echo('The value is '.$myarray['this']);
}
Or:
$blah = $myarray['this'];
if ($blah == 'test')
{
echo('The value is '.$blah);
}
I'm sure a lot of people could find use for this in the future.
Also, I'm not sure if this is a bug or not, but, the Manual says
is_null() handles mixed variables, however, this returns false:
$test = NULL;
$blah = NULL;
echo((is_null($test,$blah) ? 'Yep' : 'Nope'));
This was tested on 2k with the standard Windows lastest version of PHP
and Apache 1.3.x (last stable)
If is_null() can handle only 1 argument, please extend it for infinite
args, I have coded my own routine for this but obviously PHP's internal
would be faster.
Last, but not least, PHP is probably my favorite language, more so then
C/C++, please keep up the good work, it's truely a fantastic language
and you have all done a fantastic job with it (coders, documentation
team, web team) ;-)
Thanks.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18223&edit=1