Bonjour,

Comment je peux trouver les valeurs qui se trouvent dans un tableau qui se trouve dans un autre tableau ?
En fait, je vais assigner mes variables avec les valeurs.....

Voici mon fichier json
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{"info_tax": [
      {
         "prix_horstaxe": "5.00",
         "taxs": [
            {
               "nom": "tax1",
               "pri1": 0.05,
               "prix2": "1.05"
            },
            {
               "nom": "tax251",
               "prix1": 1.05,
               "prix2": "5.01"
            }
         ]
      }
   ]
   }
voici mes variables avec les valeurs que je veux obtenir :

$nom_a = 'tax1';
$nom_b = 'tax1';

$prix1_a = '0.05';
$prix1_b = '1.05';

$prix2_a = '1.05';
$prix2_a = '5.01';

voici ma
1re tentative :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ini_set('display_errors', 1);
 
ini_set('log_errors', 1);
 
$donee_json = "array.json";
 
$donee_json = file_get_contents($donee_json);
 
 
 
 
//											var_dump(json_decode($donee_json));
//											echo '<BR>';
//											var_dump(json_decode($donee_json, true));
//											exit();
 
 
 
$donnee_decode_json = json_decode($donee_json);
 
foreach ($donnee_decode_json->info_tax->taxs as $obj) //line 23 line 23 line 23 line 23 
	{
 
		echo $nom = $obj->nom . '< br>' . $prix1 = $obj->prix1 . '< br>' . $prix2 = $obj->prix2;
	}
Et voici message d'erreur :
Notice: Trying to get property of non-object in F:\127.0.0.3\array.php on line 23

Warning: Invalid argument supplied for foreach() in F:\127.0.0.3\array.php on line 23
pourquoi je n'arrive pas afficher mon "echo" ?
Comment je peux assigner les bonnes valeurs à mes variables ?

Merci et bonne soirée