Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
Created December 2, 2014 15:30
Show Gist options
  • Save phenix-factory/474366d92cba45775052 to your computer and use it in GitHub Desktop.
Save phenix-factory/474366d92cba45775052 to your computer and use it in GitHub Desktop.
Implode les saisies de type data pour les inserer dans la base de donnée
<?php
function saisie_implode_array($saisies, $blacklist = array()) {
foreach($saisies as $index => $saisie){
// Si on trouve une clée datas il faut implode
if (
array_key_exists ('datas', $saisie['options']) // est-ce qu'il y a des data ?
and is_array(_request($saisie['options']['nom'])) // Il faut que ce soit un tableau
and !in_array($index, $blacklist) // Si c'est dans la blacklist on touche pas
) {
set_request($saisie['options']['nom'], implode(',', _request($saisie['options']['nom'])));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment