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....!

7 Years
Discussion Span
Last Post by ahmedeqbal

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]

Edited by Daiva: n/a

Votes + Comments
Daiva Reply very helpful for me. :)

Daiva, thanks dear...!

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

thanks again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.