Splicing two dimensional php array

manfred343

I have this 2d array and like to splice or unset a,b,c,d if d is older than 30 days. Completely new to php arrays any help much appreciated.

Array 
(
    [0] => Array  (
            [0] => a
            [1] => b
            [2] => c
            [3] => d
        )
    [1] => Array  (
            [0] => a
            [1] => b
            [2] => c
            [3] => d
        )   
)


foreach($arr as $a) { 
        if($a[3] + 30 < date) {
          //??? 
    }
}
djot
foreach($arr as $index => $a) { 
  if($a[3] + 30 < date) {
    unset($arr[$index]);
  }
}

(And me, myself, and I would use associative arrays to handle it more comfortable, cause human readable)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related