我有stdClass Object
結構的下面的數組,並且需要計數提供的數量。 Std類作爲第三方API的響應接收,因此它是動態的。stdClass對象的數量在php中的數組
stdClass Object
(
[Offer] => Array
(
[0] => stdClass Object
(
[Offerid] => 1
[LoanAmount] => 2****
[InterestRate] => 2*
[Term] => 36
[MonthlyPayment] => 7***
[Annualfee] => 0
[OriginationFee] => 1***
)
[1] => stdClass Object
(
[Offerid] => 1
[LoanAmount] => 2****
[InterestRate] => 2*
[Term] => 36
[MonthlyPayment] => 7***
[Annualfee] => 0
[OriginationFee] => 1***
)
[2] => stdClass Object
(
[Offerid] => 1
[LoanAmount] => 2****
[InterestRate] => 2*
[Term] => 36
[MonthlyPayment] => 7***
[Annualfee] => 0
[OriginationFee] => 1***
)
)
)
我想在計算陣列號[報價],爲我做了以下內容:
echo "count----------".count($offers);
但它給像 count----------1
在這種情況下,計計數是和我想3作爲輸出。 請建議。 我也用過這個 echo「count ----------」。count((array)$ offers); 這也不工作。
TRY - '計數($ your_object->優惠)'。 –
我已經試過這個,它也給出了1. –
你可以在https://eval.in/上做一個小提琴嗎? –