私は配列を持っており、特定の値の数を取得したい。PHP配列から特定の値の数を取得
構造としてある:
Array (
[0] => Array (
[coupon_id] => 350
[coupon_title] => This is the title of coupons
[coupon_code] => ABCD
[coupon_type] => coupon
)
[1] => Array (
[coupon_id] => 350
[coupon_title] => This is the title of coupons
[coupon_code] => ABCD
[coupon_type] => no_coupon
)
)
今私は私がarray_value_count
で試みたが、私はこれが唯一のSTRINGと値をカウントすることができます取得していますcoupon
とno_coupon
の数を取得したいです。
'array_value_count(array_column( 'coupon_type'));それは – splash58