tags:

views:

42

answers:

3

I have this array in PHP

array(5) {
  ["mai_id"] => string(1) "3"
  ["mai_logo"] => string(0) ""
  ["mai_title"] => string(16) "Vitrine Cultural"
  ["mai_description"] => NULL
  ["mai_description2"] => NULL
}

And I'd like to remove ["mai_description"] and get only

array(5) {
  ["mai_id"] => string(1) "3"
  ["mai_logo"] => string(0) ""
  ["mai_title"] => string(16) "Vitrine Cultural"
  ["mai_description2"] => NULL
}

is there any way?

+5  A: 

Yup, use unset()

unset( $array['mai_description'] );
Peter Bailey
lol, a downvote?
Peter Bailey
+2  A: 
unset($array["mai_description"]);

ought to do the trick.

/ edited to fix syntax error even though it's the same as Peter's

Jerry Seeger
+3  A: 
unset($array['mai_description'])

but use documentation, please.

Jack