Or:
$a = array ('Cats', 'white', 'Dogs', 'black', 'Mice', 'grey', 'Camels',
'brown');
$b = '';// Just in case it has some leftover
value
$k = 2* (int) (count ($a)/2); // ensure even no of terms
$i = 0; while ($i < $k)
{
$b[$a[$i++]] = $a[$i++];
On 19 February 2010 15:52, tedd wrote:
> At 10:48 AM + 2/19/10, Richard Quadling wrote:
>>
>> On 19 February 2010 07:26, Adam Richardson wrote:
>> Or,
>
> Code fight!!!
>
> http://www.webbytedd.com/ccc/array/
>
> After reviewing the entries, mine does not provide any significant
> difference
At 10:48 AM + 2/19/10, Richard Quadling wrote:
On 19 February 2010 07:26, Adam Richardson wrote:
Or,
Code fight!!!
http://www.webbytedd.com/ccc/array/
After reviewing the entries, mine does not provide any significant
difference. I did it as a mental exercise after looking at several
On 19 February 2010 07:26, Adam Richardson wrote:
> Or,
>
> function new_arr(array $arr)
> {
> $count = count($arr);
> if ($count % 2 != 0) throw new Exception('The new_arr() function
> requires an even number of elements.');
> for ($i = 0; $i < $count; $i += 2)
> {
> $new_arr[$
Or,
function new_arr(array $arr)
{
$count = count($arr);
if ($count % 2 != 0) throw new Exception('The new_arr() function
requires an even number of elements.');
for ($i = 0; $i < $count; $i += 2)
{
$new_arr[$arr[$i]] = $arr[$i + 1];
}
return $new_arr;
}
$test = ne
On Thursday 18 February 2010 11:58:28 pm Paul M Foster wrote:
> On Fri, Feb 19, 2010 at 01:20:12PM +0800, Dasn wrote:
> > Hi guys. How to convert an array like:
> >
> > Array
> > (
> > [0] => key1
> > [1] => value1
> > [2] => key2
> > [3] => value2
> > )
> >
> > to
> >
> >
> > Array
On Fri, Feb 19, 2010 at 01:20:12PM +0800, Dasn wrote:
> Hi guys. How to convert an array like:
>
> Array
> (
> [0] => key1
> [1] => value1
> [2] => key2
> [3] => value2
> )
>
> to
>
>
> Array
> (
> [key1] => value1
> [key2] => value2
> )
>
> Is there a built-in function to
At 01:38 30.05.2003, John Wulff said:
[snip]
>I'm new to working with complex arrays/objects and need a little help.
>Below is the array I need to convert to a different type of array. The
>"begin what i have" section is data I've succesfully mined from an X
8 matches
Mail list logo