php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15574 Strip out array keys with no value
Submitted: 2002-02-15 12:28 UTC Modified: 2002-02-15 12:38 UTC
From: zakstergrant at hotmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.1.1 OS: Linux Mandrake 8.2b2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zakstergrant at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-02-15 12:28 UTC] zakstergrant at hotmail dot com
Is it possible to add a function which strips out all parts of an array which don't have a value?  I ask this simply because I'm trying to array_diff a submitted form against a set of required fields, and my test machine (Win2K/IE5) sends all empty form elements over in an array (I use NAME="FormData[Bar]", NAME="FormData[Baz]", etc) with empty values, and PHP puts them into my form array.

It'd be great if I could say "array_strip_empty($myarray)" and PHP took out all values which are "" (empty)

Thanks,


~ZG~

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-15 12:36 UTC] cynic@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
 [2002-02-15 12:38 UTC] cynic@php.net
just in case you were wondering why your question was a support stuff:
eliminating empty values from an array is a one-liner with today's capabilities. 
no reason to add this function.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 14:01:37 2025 UTC