[PHP] array manipulations
Wow this was really elegant!! thank you!! :-) > if (0 < strlen(implode('',$a))) { > // error > } > > Stas - Per te Blu American Express รจ gratis
Re: [PHP] array manipulations
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 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 unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array manipulations
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. Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array manipulations
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 unsubscribe, visit: http://www.php.net/unsub.php