php - checking if there is valid data before implode -


i have array built dynamically, need check if empty before process (implode it)

is there way isset or checking array index...

i need know if not empty , array when empty keeps given me count of 1

edited:

my array build code

$( function() { $( "#btn4" ).click( function() {      var cid = new array();     $( "input[name='cid[]']:checked" ).each( function() {             cid.push( $( ).val() ); 

i send trow ajax $_post , if there checkbox selected every thing works fine, if empty implode error ... tryed check if empty $array , tryed count $array , nothing works...

you may use:

if(count($arr)) 

count() checks amount of items in array, therefore 0 elements evaluate false;


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -