On 11-01-13 05:35 PM, [email protected] wrote: >>>>>> "DF" == Daniel Friesen<[email protected]> writes: > DF> Using in_array and array_diff on an exploded array should work fine. > OK, but that would take several times as many lines than my current: > > foreach(array_keys($links['namespaces']) as $ns){ > if(strpos($ns,'talk')!==false){ > if('new'==$links['namespaces'][$ns]['class']){ > unset($links['namespaces'][$ns]);}}} > > and force me to hardwire in more specific knowledge of your current > structure, no? I'm talking about on class strings. `in_array('new', explode(' ', $links['namespaces'][$ns]['class']));` rather than `'new'==$links['namespaces'][$ns]['class']` which will break should another class be added to that item. And you can use array_diff in a similar way to check for multiple classes
Still, I wish we never started using classes like this in the first place. These would have been much better off as array keys. ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] -- ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
