John Taylor-Johnston wrote:
How can I use "if" to see an array contains something?
if (sizeof($array)) ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Philipp Schwarz wrote:
> Try this:
>
> if (is_array($array) && count($array)) {
given that your not interested in the actual count of the array,
only that is is not empty, save yourself a couple of CPU cycles
and use empty() instead ...
if (is_array($array) && !empty($array)) {
foreach
John Taylor-Johnston wrote:
How can I use "if" to see an array contains something?
php.net/in_array
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Try this:
if (is_array($array) && count($array)) {
...
}
John Taylor-Johnston schrieb:
How can I use "if" to see an array contains something?
if ($array()) does not work, of course.
John
--
Mit freundlichen Grüßen
Philipp Schwarz
-
comtr
4 matches
Mail list logo