For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2006 > Re: aray_push($myArray, key=>data









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: aray_push($myArray, key=>data
ZeldorBlat

2006-09-26, 6:57 pm


Jean Pierre Daviau wrote:
> Hi gurus,
>
> Is this possible aray_push($myArray, key=>data?
>
> $myArray = array('rayon' =>98);
> array_push($myArray, 'PI'=>3.1416);
>
>
> --
> Thanks for your attention.
>
> Jean Pierre Daviau
> --
> Easyphp1.8 with Apache1.3.24
> Server version: Apache/2.0.55
> Server built: Oct 9 2005 19:16:56
> DEVC++, borland 5.5
> windows Xp
> asus p4 s533/333/133
> Intel(R) Celeron (R) CPU 2.00 GHz
> Processor Radeon7000 0x5159 agp
> http://www.jeanpierredaviau.com


You don't need array_push to do what you're trying to do. This will
work fine:

$myArray = array('rayon' => 98);
$myArray['PI'] = 3.1416;

Koncept

2006-10-12, 6:59 pm

In article <1159288523.208645.168910@m7g2000cwm.googlegroups.com>,
ZeldorBlat <zeldorblat@gmail.com> wrote:

> Jean Pierre Daviau wrote:
>
> You don't need array_push to do what you're trying to do. This will
> work fine:
>
> $myArray = array('rayon' => 98);
> $myArray['PI'] = 3.1416;
>


<?php
// I realize that ZeldorBlat was demonstrating methods of array
// assignment, so I am just going to expand further if you comprehend
// his concepts:
$myArray = array( 'rayon' => 98, 'PI' => pi() );
// dump it out for verification
print_r($myArray);
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com