[prev in list] [next in list] [prev in thread] [next in thread]
List: php-doc-bugs
Subject: [DOC-BUGS] [PHP-BUG] Doc #62706 [NEW]: array_map documentation is missing info about "use" keyword
From: "lists at box dot cz"<php-bugs () lists ! php ! net>
Date: 2012-07-31 17:51:21
Message-ID: bug-62706 () bugs ! php ! net
[Download RAW message or body]
From: lists at box dot cz
Operating system: irrelevant
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:array_map documentation is missing info about "use" keyword
Description:
------------
---
From manual page:
http://www.php.net/function.array-map#refsect1-function.array-map-examples
---
When first looking at array_map() I thought it's a fantastically useless
function (compared to other languages, Ruby being notable example).
The reason was perceived inability to access parent scope.
Only when discussing the matter with a more skilled PHP dev I was told
there is a way to access parent scope.
Therefore the documentation should include mention of the construct:
<?php
$vars = array('a' => 'one', 'b' => 'two', 'c' => 'three');
$a = array('a', 'b', 'c');
$f = function($x) use ($vars) { return $vars[$x]; };
print_r(array_map($f, $a));
?>
to make it abundantly clear it is, indeed, possible.
Expected result:
----------------
To find the info in that docs section.
Actual result:
--------------
No mention of "use" within official text.
--
Edit bug report at https://bugs.php.net/bug.php?id=62706&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62706&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62706&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62706&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62706&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62706&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62706&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62706&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62706&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62706&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62706&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62706&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62706&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62706&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62706&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62706&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62706&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62706&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62706&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62706&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62706&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62706&r=mysqlcfg
--
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic