Jump to content

PHP - Returning value while still executing code


shaunshull

Recommended Posts

Anyone know of a way to return data to a browser and then continue processing code. For example in classic ASP they have:

 

<%

Response.write('THE BROWSER CAN SEE THIS');

// sending final response to the browser

Response.end;

// this will still execute even though the browser no longer is waiting for a response

my_function();

%>

 

I would like to immediately return a value to the browser and then run cleanup code without the browser having to wait. When I use the exit() or die() or return() functions in PHP it will end the code right at that point which is great because the browser gets a response back quickly but the remaining code never gets executed.

I have never heard of anyone needing this/using this.

 

I am sure there is a way, maybe. But yea thats the glorious part about PHP, it is completely different than ASP =) Thank heavens!

 

EDIT:

 

I am taking it this is not what you are looking for:

 

<?php
print "test";

myFunction();
?>

 

As the browser is still waiting for a response.

 

Yet another EDIT:

 

http://us3.php.net/manual/en/features.connection-handling.php

 

Maybe that is what you are looking for?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.