jeudi 2 mars 2017

How to check if there exists a key in an array that contains a certain string in php?

I am working on a webapp right now in PHP. So far there is a defined array with the following structure:

$array = array("check_first" => true, "check_second" => false)

There are also much other arrays with default nummerical structure with keys: 0, 1,2,3 ect.

I want now to make a difference between the arrays with keys of nummerical and arrays with keys of strings that starts with "check_".

So I would like to search through all my defined arrays if there is a array with keys that contains the string "check_". I would prefer a simple if-statement for this.

I hope this makes sense. Thanks for all your comments!




Aucun commentaire:

Enregistrer un commentaire