How to determine if an array has any elements or not?

后端 未结 8 2007
青春惊慌失措
青春惊慌失措 2020-12-06 09:31

How do I find if an array has one or more elements?

I need to execute a block of code where the size of the array is greater than zero.

if ($result &         


        
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 10:11

    $ii = 1;
    $arry_count = count($args);
    foreach ( $args as $post)
    {
        if( $ii == $arry_count )
        {
            $last = 'blog_last_item';
        }
        echo $last;
        $ii++; 
    }
    

提交回复
热议问题