From: technophreak at gammae dot com Operating system: all PHP version: 4.3.2 PHP Bug Type: Feature/Change Request Bug description: array_element function.
Description: ------------ There should be a function used to simply return element [n] of an array. This will allow to return the value of an array by simply specifying the key or element to be returned. list() or any other function can do this. if a such function alredy exist please let me know. I didnt find it. Reproduce code: --------------- Sample code of what function should do. function array_element($array array,$element mixed){ return $array[$element]; } here is an example of why that would be useful. If i dont want to write two lines to get a hostname from a url. $myhost = array_element(parse_url($someurl),"host"); INSTEAD OF $host_info = parse_url($someurl); $myhost = $host_info["host"]; Also.. there are many things that the list() function cannot do ... an array_element() function would be very useful in any situation where the array would be the result of another function .. There are numerous examples where I would have used that and I am sure that a lot of people would be looking for suck feature. Same idea for an array_put() function but array_merge() does the same. -- Edit bug report at http://bugs.php.net/?id=26347&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26347&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26347&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26347&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26347&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26347&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26347&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26347&r=support Expected behavior: http://bugs.php.net/fix.php?id=26347&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26347&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26347&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26347&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26347&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26347&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26347&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26347&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26347&r=float