$foo = array('one'); $foofoo = array('onekey' => 'onevalue');
How to check if an array contains only one key?
count() will tell you how many elements are in the array
count()
if (count($foo) === 1) { echo 'This array contains one value'; }
Source: https://habr.com/ru/post/914483/More articles:Is there a way to regexp-quote strings in Node.js? - javascriptStatic Arrays VS. dynamic arrays in C ++ 11 - c ++Is the substitution execution like a batch parameter if the packet is empty? - c ++OpenArray InputArray / OutputArray - opencvSpeech recognition error does not start in Windows service - c #ManyToOne with where clause - hibernateBit shift, when not ... bit shift operator - bit-manipulationHow do I display a Sencha Touch list in a VBOX layout? - sencha-touchMaximize the sum of non-overlapping numbers from the matrix - algorithmFFT Pitch Detection for iOS using accelerator system? - iosAll Articles