J
J
johjessica72021-08-04 23:05:04
PHP
johjessica7, 2021-08-04 23:05:04

How to count how many times a phrase occurs in a php array?

There is an array:

Array ( [result] => Array ( [0] => Array ( [warehouse_id] => 11111111111111[product_id] => 105757633 [offer_id] => A2275 [updated] => [errors] => Array ( [0] => Array ( [code] => SKU_STOCK_NOT_CHANGE [message] => sku stock not changed ) ) ) [1] => Array ( [warehouse_id] => 11111111111111[product_id] => 105760010 [offer_id] => A1143 [updated] => [errors] => Array ( [0] => Array ( [code] => SKU_STOCK_NOT_CHANGE [message] => sku stock not changed ) ) ) [2] => Array ( [warehouse_id] => 11111111111111[product_id] => 105761741 [offer_id] => A2585 [updated] => [errors] => Array ( [0] => Array ( [code] => SKU_STOCK_NOT_CHANGE [message] => sku stock not changed ) ) )


How to count how many times the phrase "sku stock not changed" occurs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2021-08-14
@ev_g

Convert the array to json and find the number of occurrences of the desired string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question