|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-23 04:52 UTC] hholzgra@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
I wrote a function like that function rm_empty_values($array) { $x = 0; foreach ($array as $key => $value) { if($value) { $array_temp[$x] = $value; $x++; } } return $array_temp; } $hede = array("hede", "hodo", "0", 1); $list = rm_empty_values($hede); print_r($list); but it removes $hede[2] (0 value) too and i modified my function to function rm_empty_values($array) { $x = 0; foreach ($array as $key => $value) { if(($value) || ($value == "0")) { $array_temp[$x] = $value; $x++; } } return $array_temp; } and it works.