Wow this was really elegant!! thank you!! :-)
> if (0 < strlen(implode('',$a))) {
> // error
> }
>
> Stas
-
Per te Blu American Express รจ gratis
if all you might have there is 'error', try
if(array_search('error',$array) === FALSE) {
echo 'not ok';
}
if you might have different strings, do
$result='ok';
foreach($array as $v) {
if($v) {
$result ='not ok';
break;
}
}
Mattia wrote:
Can anyone suggest an ELEGANT way t
Mattia,
> Can anyone suggest an ELEGANT way to find out if an array is made of empty
> strings or not?
> example
> $a = Array( '' , '' , '' ); //ok
> $b = Array( '' , '' , 'error' ); // not ok
> $c = Array( 'error' , '' , 'error' ); // not ok
implode() then check for nullstring/count characters.
Can anyone suggest an ELEGANT way to find out if an array is made of empty
strings or not?
example
$a = Array( '' , '' , '' ); //ok
$b = Array( '' , '' , 'error' ); // not ok
$c = Array( 'error' , '' , 'error' ); // not ok
tia
Mattia
--
PHP General Mailing List (http://www.php.net/)
To unsub
4 matches
Mail list logo