note 44103 added to function.array-combine
| From: | trosos at atlas dot cz | Date: | Thu, 15 Jul 2004 09:12:43 +0000 |
| Subject: | note 44103 added to function.array-combine | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73273@lists.php.net to get a copy of this message | ||
For those who wants to use the array_combine() in php 4, there is an alternative:
<?php
if (!Function_Exists('array_combine'))
{
function Array_Combine($Keys,$Values)
{
Reset($Keys);
Reset($Values);
$Result=array();
while
(((
($Key=Each($Keys)) !==False
)
or
(((
Each($Values) !==False
)
or
(
Count($Keys) ===0
)
)
and
(
$Result=False
)
)
)
and
((
($Value=Each($Values)) !==False
)
or
(
$Result=False
)
)
and
(
($Result[$Key[1]]=$Value[1]) or True
)
) {};
return($Result);
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.array-combine.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44103
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44103&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44103&report=yes
Search -- http://master.php.net/manage/user-notes.php