Hello dear friends,
I’ve one problem. I hope you guys help in this…!

Actually, I have two array.
One array carry ‘title’ of my sms text messages.
Second array carry ‘description of sms messages.

Problem is that…! i want to got these two array result in my foreach loop.
As you know foreach loop carry one time one array result….!
How its possible I’ll get these two array result in one loop???
Please, let me know how to declare these two array in foreach….!

thanks waiting for your reply....!

Recommended Answers

All 4 Replies

Why do you want to use a foreach loop is in this case?
If I were you I would do a for loop from 0 to size of your arrays and use that index to get the same position values in both arrays.

$sms_title = $title[0]; // this array contain sms title

$sms_detail = $detail[0]; // this array contain sms detail

foreach () {


i want to get Result of >> $sms_title

i want to get Result of >> $sms_detail

After this>>

i want to use Mysql INSERT query to insert $sms_title, $sms_detail in to database

}

***if you have another solution please, explain with example....! please..... :(

Now I don't understand what you want to do...
I thought you need something like:

$sizeOfArrays = count($sms_titles);

for ($i = 0; $i < $sizeOfArrays; $i++) {
    INSERT into DB -> $sms_titles[i] and $sms_details[i]
}
commented: Daiva Reply very helpful for me. :) +2

Daiva, thanks dear...!

you are right...! For loop is right solution...!

thanks again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.