PHP Add Column to two dimentional array i do have two dimentional array of data in php.  

I do want to add another column with constant to that array for passing tabular data to next program.

i am iterating and adding manually. What can be alternate code?

my code:

            if( is_array( $arrSource )){
                foreach( $arrSource as &amp;$dataRow){
                    foreach( $arrColumn as $k=&gt;$v)
                        $dataRow[$k] = $v;
                }                
                unset( $dataRow );
            }
I see nothing wrong with what you already have. Assuming of course that you meant to append identical data to each $arrSource element. You are already doing the shorthand by using the reference operator. The only other way would be to write it all out manually, which would be pointless, unless you are looking for more novice readable code. I would hesitate to add, however, that unset should be called tithin the first foreach loop. Though I could not confirm 100% because I don't use the reference operator to know its quirks :)