Hi Kuldeep,
Why would you want to do this, it seems to me there is more code than the
regular array access method.
Kind regards,
Chris van Dam
Op 30-09-12 13:50 schreef kuldeep dhaka :
>hello guys,
>this is my first time, if thing mail is at wrong place please forward it
>the right place.
>whi
Those look good except that you're using isset($ar[$key]) when you should
be using array_key_exists($key, $ar). If the value you were trying to set
is set to null, your function will erroneously return false instead of null
(since it isn't 'set', but the key does in fact exist)
On Sun, Sep 30, 201
On 30/09/12 13:05, kuldeep dhaka wrote:
i m extending the wordpress internal widget input api to simplify things,
so for that i wanted a function that perform drill.
i have considered other options but they wont be effecient, if a php
internal function is build it would be just a [] similar one,
i m extending the wordpress internal widget input api to simplify things,
so for that i wanted a function that perform drill.
i have considered other options but they wont be effecient, if a php
internal function is build it would be just a [] similar one, and most
effecient
because while recursi
kuldeep dhaka wrote:
> /*
> i was thinking if is their any function that can do the above work like
> */
> echo array_drill($array, array("school","class","roll_number","name"));
The following should work:
function array_drill($array, $keys) {
while (($key = array_shift($keys)) !== null)
Yes, it's fairly trivial to write a function for this. I wrote a pair of
them in about 2 minutes:
http://codepad.viper-7.com/rqVlqL
On Sun, Sep 30, 2012 at 7:56 AM, Charlie Somerville <
char...@charliesomerville.com> wrote:
> I'm struggling to imagine how such a function would be useful consid
I'm struggling to imagine how such a function would be useful considering you
can already use [] to index arrays.
If you have a variable 'depth' you need to drill down to, then writing a
function to do that is also fairly trivial.
On Sunday, 30 September 2012 at 9:50 PM, kuldeep dhaka wrote: