Hi Sorry for my PHP-oriented question, but I can’t find my solution
$some2 = 'ok'; if ($some1 == $some2) echo 'well ok';
Works and I get “well ok” But if I set an array it doesn’t work
$some2 = array('ok', 'ok2', 'ok3'); if ($some1 == $some2) echo 'well ok';
Looks like you are looking for in_array
$some2 = ['not-ok', 'almost-ok', 'ok']; if (in_array('ok', $some2)) { echo 'well ok'; }
What do you want to compare? Check if two arrays are equal? Or if an element is contained in an array? For the latter, use in_array(), for the first, use == or === depending on whether or not you want to compare order as well.
in_array()
==
===
http://www.php.net/manual/en/language.operators.array.php
Thanks, I was looking for <?php if (in_array($some1, $some2)) { echo 'well ok'; } ?>
<?php if (in_array($some1, $some2)) { echo 'well ok'; } ?>