Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.php > #3232

Fonction pour éclater un tableau

Subject Fonction pour éclater un tableau
From Stéphane Santon <news901@team-santonum.com>
Newsgroups fr.comp.lang.php
Message-ID <mn.13c47e4548fe9e07.121262@team-santonum.com> (permalink)
Organization cdie
Date 2020-05-02 16:04 +0200

Show all headers | View raw


Bonjour,

J'ai une variable texte qui contient :

$filtre= 'article=477,rubrique=201,branche=25';

Comment arriver simplement à un tableau qui contient :
'article' => 477
'rubrique' => 201
'branche' => 25

?

Je peux faire un explode pour avoir
0 => 'article=477'
1 => 'rubrique=201'
2 => 'branche=25'

Mais je n'ai pas de fonction magique pour la suite (sauf à un code plus 
complet qui détecte le '=', et patati...)

Si Php dispose de fonction permettant de le faire plus facilement en 
remplaçant le '=' de la chaine de départ, je peux le changer, c'est une 
chaine de configuration que je peux changer.

Merci




-- 
Stéphane
BTS Electrotechnique *** http://www.bts-electrotechnique.fr
En alternance : http://www.ufa-palissy.fr
Domotique : http://www.ecodomotique.fr

Back to fr.comp.lang.php | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Fonction pour éclater un tableau Stéphane Santon <news901@team-santonum.com> - 2020-05-02 16:04 +0200
  Re: Fonction pour éclater un tableau Didier <nospam@invalid.fr> - 2020-05-02 16:22 +0200
    Re: Re=3a Fonction pour =c3=a9clater un tableau Stéphane Santon <news901@team-santonum.com> - 2020-05-02 21:30 +0200
      Re: Re=3a Fonction pour =c3=a9clater un tableau Olivier Miakinen <om+news@miakinen.net> - 2020-05-04 00:20 +0200
  Re: Fonction pour éclater un tableau Olivier Miakinen <om+news@miakinen.net> - 2020-05-03 00:01 +0200

csiph-web