Hi! I have a relatively simple question, or so i think! I have two arrays of strings, and i want to be able to concatenate each element of the first array with each element of the second. I have tried a couple of things and they did not work out. Can i get some help?
Here's an example of what i'm trying to do.
$firstarray[] = array("hello", "world");
$secondarray[] = array("good", "day");
I want to be able to produce a third array which contains:
$thirdarray[] = array ("hello good", "world day");
Is that possible? I have tried looping and a couple of other things to concatenate each element of the first string with each element but with no success. I don't get the required output. Please help.
You can sure do that with
You can sure do that with couple of foreach loops.
But can you explain what exactly you're trying to do? Perhaps, you could avoid concatenating each array element like this.
Hi Sudheer! This is about as
Hi Sudheer! This is about as precise as i can be.
$firstarray[] = array("good", "morning");
$second[] = array("good", "day");
I wish get $result = array("good good", "morning day");
I have tried foreach loops i think, with little success. Maybe i was missing something. Thank you for replying.
I got it. :)
I got it. :)
Post new comment