PHP output of foreach loop into a new array.
        Posted  
        
            by RobHardgood
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by RobHardgood
        
        
        
        Published on 2010-03-28T04:33:20Z
        Indexed on 
            2010/03/28
            4:43 UTC
        
        
        Read the original article
        Hit count: 350
        
I know I'm probably missing something easy, but I have a foreach loop and I'm trying to modify the values of the first array, and output a new array with the modifications as the new values.
Basically I'm starting with an array: 0 => A:B 1 => B:C 2 => C:D
And I'm using explode() to strip out the :'s and second letters, so I want to be left with an array: 0 => A 1 => B 2 => C
The explode() part of my function works fine, but I only seem to get single string outputs. A, B, and C.
© Stack Overflow or respective owner