php - Unsetting values on a multidimentional array in a foreach loop -


i got multidimentional array of objetcts wich needs "filtered" in cases. function wrote:

foreach($data["index"] $key => $value){     if(preg_match("/expression/",$value->property)){         unset($data["index"][$key]);     } } 

it doesn't returns me errors, when array var_dumped, values thought i've unset still there.

i found on topic:

foreach ($this->result['list'] $key => &$row) {     if ($this_row_is_boring) {         unset($this->result['list'][$key]);     } } 

i think difference 1 wrote, calls $this->result when call $data.

any ideas? thanks

if regular expression makes no match, unset() never called.

can insert statement determine if preg_match() ever returns true?

if(preg_match("/expression/",$value->property)){     unset($data["index"][$key]);     echo "match found \$key: $key\n"; } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -