Re: [PHP4BETA] howto remove key/value...+ SYNTAX Q

From: Date: Tue, 11 Apr 2000 15:32:00 +0000
Subject: Re: [PHP4BETA] howto remove key/value...+ SYNTAX Q
References: 1 2 3  Groups: php.version4 
Request: Send a blank email to php-version4+get-13392@lists.php.net to get a copy of this message
Hi Anh! On Tue, 11 Apr 2000, Anh (Ly) Vuong wrote: > > I believe unset() will affect the array's internal pointer. So, it's > better to use list(..) and each(..). I would do something similar to nope, this: $array [0] = " "; $array [1] = "foo"; $array [2] = "\n"; $array [3] = "bar"; foreach ($array as $k => $v) { if (trim($v) == '') unset($array[$k]); } var_dump($array); outputs: array(2) { [1]=> string(3) "foo" [3]=> string(3) "bar" } which I guess it's the expected result. SYNTAX Q: why ( trim($v) == '') && unset ($array[$k]); in the example above gives a parse error? -- teodor

« previous php.version4 (#13392) next »