Doc #77878 [Opn->Csd]: array_filter example improvement

From: Date: Fri, 12 Apr 2019 09:16:15 +0000
Subject: Doc #77878 [Opn->Csd]: array_filter example improvement
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16567@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77878&edit=1 ID: 77878 Updated by: peehaa@php.net Reported by: php-bugs at allenjb dot me dot uk Summary: array_filter example improvement -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: peehaa Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2019-04-12 09:14:24] peehaa@php.net Automatic comment from SVN on behalf of peehaa Revision: http://svn.php.net/viewvc/?view=revision&revision=347206 Log: Adds examples of array_filter behavior with 0 string and integer. Closes #77878 ------------------------------------------------------------------------ [2019-04-11 16:52:06] php-bugs at allenjb dot me dot uk Description: ------------ The 2nd example for array_filter shows its usage without a callback to filter empty array elements. The example does not include entries for zero values, which could cause issues for newer developers who aren't familiar with PHP's type system. I would suggest updating the example to include zero values: $entry = array( 0 => 'foo', 1 => false, 2 => -1, 3 => null, 4 => '', 5 => '0', 6 => 0, ); print_r(array_filter($entry)); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77878&edit=1

« previous php.doc.bugs (#16567) next »