Jump to content

Recommended Posts

I know it's a stupid question however if I had a simple program that did this:

 

<?PHP

//INSTANCE ONE
$i = 1;
while ($i <= 10) {
    echo $i++; 
}

//INSTANCE TWO
$A = 1;
while ($i <= 10) {
    echo $A++; 
}

//INSTANCE THREE
$Z = 1;
while ($i <= 10) {
    echo $z++; 
}

?>

 

What seems to happen is that the program will output each one in order before moving to the next 'while' rather then all at the same time or 'simultaneously' output all three.

 

Just curious if there's another way.

I know it's a stupid question however if I had a simple program that did this:

 

<?PHP

//INSTANCE ONE
$i = 1;
while ($i <= 10) {
    echo $i++; 
}

//INSTANCE TWO
$A = 1;
while ($i <= 10) {
    echo $A++; 
}

//INSTANCE THREE
$Z = 1;
while ($i <= 10) {
    echo $z++; 
}

?>

 

What seems to happen is that the program will output each one in order before moving to the next 'while' rather then all at the same time or 'simultaneously' output all three.

 

Just curious if there's another way.

 

For the most part, computers can do nothing simultaneously. Each action comes before the other. What is your desired output?

If you want to output all three at the same time, collect them in a string or look into output buffering via ob_start and ob_get_clean.  And then just echo that one string and viola. If you are wanting it to run all 3 simultaneously, I know of no way to do it other then opening 3 different pages which have 3 different whiles "at the same time".

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.