goldmen Posté 6 Avril 2007 Partager Posté 6 Avril 2007 Bonjour Le resultat affiché d'une variable print_r($tableau); sur mon script donne ceci : Array ( [TTI_transmission] => Array ( [quoteresult] => Array ( [0] => Array ( [symbolfound] => 1 [tickersymbol] => $DJI [companyname] => DOW JONES INDUSTRIAL AVERAGE [last] => 12560.20 [change] => +30.15 [pcthange] => +0.24 [volume] => 164,930,779 ) [1] => Array ( [symbolfound] => 1 [tickersymbol] => SPX [companyname] => STANDARD AND POORS 500 INDEX [last] => 1443.76 [change] => +4.39 [pcthange] => +0.30 [volume] => 0 ) [2] => Array ( [symbolfound] => 1 [tickersymbol] => TSEA.CA [companyname] => S&P/TSX COMPOSITE INDEX [last] => 13425.02 [change] => -23.29 [pcthange] => -0.17 [volume] => 0 ) [3] => Array ( [symbolfound] => 1 [tickersymbol] => JX.CA [companyname] => S&P/TSX VENTURE COMPOSITE [last] => 3257.43 [change] => +16.46 [pcthange] => +0.51 [volume] => 0 ) [4] => Array ( [symbolfound] => 1 [tickersymbol] => /GC7J [companyname] => GOLD APRIL [last] => 674.20 [change] => +2.10 [pcthange] => +0.31 [volume] => 1,718 ) [5] => Array ( [symbolfound] => 1 [tickersymbol] => /SI7J [companyname] => SILVER APRIL [last] => 13.694 [change] => +0.124 [pcthange] => +0.91 [volume] => 0 ) [6] => Array ( [symbolfound] => 1 [tickersymbol] => /CL7K [companyname] => CRUDE OIL LT SWEET MAY NT [last] => 63.94 [change] => -0.34 [pcthange] => -0.53 [volume] => 180,648 ) [7] => Array ( [symbolfound] => 1 [tickersymbol] => /NG7K [companyname] => HENRY HUB NAT GAS MAY NT [last] => 7.625 [change] => +0.018 [pcthange] => +0.24 [volume] => 35,260 ) [8] => Array ( [symbolfound] => 1 [tickersymbol] => /HG7J [companyname] => COPPER APRIL [last] => 3.371 [change] => -0.0115 [pcthange] => -0.34 [volume] => 304 ) [9] => Array ( [symbolfound] => 1 [tickersymbol] => /PL7J [companyname] => PLATINUM APRIL NT [last] => 1261.00 [change] => -1.90 [pcthange] => -0.15 [volume] => 24 ) [10] => Array ( [symbolfound] => 1 [tickersymbol] => /PA7J [companyname] => PALLADIUM APRIL NT [last] => 0.00 [change] => 0.00 [pcthange] => 0.00 [volume] => 0 ) [11] => Array ( [symbolfound] => 1 [tickersymbol] => /QL7K [companyname] => COAL MAY NT [last] => 41.25 [change] => 0.00 [pcthange] => 0.00 [volume] => 0 ) ) [datestamp] => Friday, April 6, 2:01 PM ) ) Or, l'information que je cherche à afficher dans tout ce code est celle en 8ème ligne "674.20" Merci de votre aide Lien vers le commentaire Partager sur d’autres sites More sharing options...
Sarc Posté 9 Avril 2007 Partager Posté 9 Avril 2007 Pour afficher un élément de tableau c'est : echo $tableau['dim1']['dim2']['dim3']...['variable']; Je ne connais pas la structure de ton tableau, mais tu dois la connaître (du moins j'espère) donc tu sauras quelle est "l'adresse" de ta variable dans le tableau... Bonne chance Lien vers le commentaire Partager sur d’autres sites More sharing options...
loxi Posté 9 Avril 2007 Partager Posté 9 Avril 2007 echo "<pre>";echo var_dump($tableau];echo "</pre>"; ce sera déja plus facile de t'y retrouver. Lien vers le commentaire Partager sur d’autres sites More sharing options...
ZeBrian Posté 11 Avril 2007 Partager Posté 11 Avril 2007 L'autre solution, que je trouve un peu plus rapide, c'est de regarder le code source de ta page dans ton navigateur, où les sauts de ligne apparaîtront. Sous Firefox, le raccourci clavier est CTRL + U Lien vers le commentaire Partager sur d’autres sites More sharing options...
DarkVaV Posté 14 Avril 2007 Partager Posté 14 Avril 2007 echo $tableau['last']; renverra 674.20 Lien vers le commentaire Partager sur d’autres sites More sharing options...
Sarc Posté 14 Avril 2007 Partager Posté 14 Avril 2007 DarkVaV bien tenté ! Mais faux. C'est un tableau à plusieurs dimensions, et la valeur 674.20 ne se trouve largement pas dans la première dimension du tableau, à première vue... Suffit de voir juste ça : [4] => Array ( [symbolfound] => 1 [tickersymbol] => /GC7J [companyname] => GOLD APRIL [last] => 674.20 Ca montre qu'il est déjà dans un sous-tableau nommé [4]... Et y'a ptet encore des dimensions à remonter. Bref, on lui a déjà dit comment faire, et on n'a pas eu de nouvelles... Lien vers le commentaire Partager sur d’autres sites More sharing options...
Sujets conseillés
Veuillez vous connecter pour commenter
Vous pourrez laisser un commentaire après vous êtes connecté.
Connectez-vous maintenant