[ create a new paste ] login | about

Link: http://codepad.org/l2C0Efab    [ raw code | output | fork ]

ryanjbonnell - PHP, pasted on Jun 28:
<?php

    function is_array_empty( $mixed ) {
        if ( is_array($mixed) ) {
            foreach ($mixed as $value) {
                if ( ! is_array_empty($value) ) {
                    return false;
                }
            }
        } elseif ( ! empty($mixed) ) {
            return false;
        }
    
        return true;
    }

    $products = array(
        'product_data' => array(
            0 => array(
                'title' => '',
                'description' => null,
                'price' => '',
            ),
        ),
    );

    var_dump( is_array_empty($products) );
    
?>


Output:
1
bool(true)


Create a new paste based on this one


Comments: