How to get the previous value from incrementing variable in for loop?
        Posted  
        
            by Parth
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Parth
        
        
        
        Published on 2010-04-28T09:05:51Z
        Indexed on 
            2010/04/28
            9:13 UTC
        
        
        Read the original article
        Hit count: 302
        
In My last post I asked : How to create dynamic incrementing variable using "for" loop in php? like wise: $track_1,$track_2,$track_3,$track_4..... so on....
whose answer I selected as
for($i = 0; $i < 10; $i++) {
  $name = "track_$i";
  $$name = 'hello';
}
and
for($i = 0; $i < 10; $i++) {
    ${'track_' . $i} = 'val'
}
Now, What If I need the Value of variable previous than the current variable?
© Stack Overflow or respective owner