“foreach in json objek php” Kode Jawaban

PHP Loop melalui JSON

$arr = json_decode('[{"var1":"9","var2":"16","var3":"16"},{"var1":"8","var2":"15","var3":"15"}]');

foreach($arr as $item) { //foreach element in $arr
    $uses = $item['var1']; //etc
}
Mobile Star

foreach in json objek php

object(stdClass)#5 (2) {
  ["status"]=>
  string(2) "ok"
  ["data"]=>
  object(stdClass)#19 (4) {
    ["id"]=>
    int(38037809)
    ["type"]=>
    string(4) "spot"
    ["state"]=>
    string(7) "working"
    ["list"]=>
    array(930) {
      [0]=>
      object(stdClass)#23 (4) {
        ["currency"]=>
        string(3) "ioi"
        ["type"]=>
        string(5) "trade"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      [1]=>
      object(stdClass)#30 (4) {
        ["currency"]=>
        string(3) "ioi"
        ["type"]=>
        string(6) "frozen"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      [2]=>
      object(stdClass)#28 (4) {
        ["currency"]=>
        string(3) "lun"
        ["type"]=>
        string(5) "trade"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      [3]=>
      object(stdClass)#33 (4) {
        ["currency"]=>
        string(3) "lun"
        ["type"]=>
        string(6) "frozen"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      [4]=>
      object(stdClass)#35 (4) {
        ["currency"]=>
        string(3) "ksm"
        ["type"]=>
        string(5) "trade"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      [5]=>
      object(stdClass)#15 (4) {
        ["currency"]=>
        string(3) "ksm"
        ["type"]=>
        string(6) "frozen"
        ["balance"]=>
        string(1) "0"
        ["seq-num"]=>
        string(1) "0"
      }
      }
Defiant Dormouse

Jawaban yang mirip dengan “foreach in json objek php”

Pertanyaan yang mirip dengan “foreach in json objek php”

Lebih banyak jawaban terkait untuk “foreach in json objek php” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya