Jump to content

Prevent Blanks in Array


jarvis

Recommended Posts

Hi,

How do you prevent the following happening:

Array
(
    [] => Array

So, effectively I want to remove that one from the main array. i.e.

Array
(
    [] => Array
        (
            [0] => Japanese GP
            [1] => Japanese GP
            [2] => Williams
        )

    [2005] => Array
        (
            [0] => Japanese GP
            [1] => Williams
        )

    [2006] => Array
        (
            [0] => Japanese GP
        )

)

Becomes: 

Array
(

    [2005] => Array
        (
            [0] => Japanese GP
            [1] => Williams
        )

    [2006] => Array
        (
            [0] => Japanese GP
        )

)

I tried using:

if (!empty($year['value'])):

Within my foreach but sadly that didn't work

 

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.