Skip to content

Instantly share code, notes, and snippets.

@robwilkerson
Created September 27, 2011 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robwilkerson/1245045 to your computer and use it in GitHub Desktop.
Save robwilkerson/1245045 to your computer and use it in GitHub Desktop.
CakePHP: Remove empty array elements at any level.
/**
* Removes items from an array where key information is missing. Useful in
* dynamic add situations.
*/
$this->data['Date'] = Set::extract( '/Date[start=/\S+/][end=/\S+/]/.', $this->data );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment