How can I make sure that the function startProcess();is called, but does not stop execution for myFunction(). I suppose there is a way to call a function and not let it return its value in order to do this in this way?
startProcess();
myFunction()
Pseudo Code:
function myFunction() { startProcess(); return $something; } function startProcess() { sleep(5); // Do stuff that user doesn't should have to wait for. }
You cannot do this. PHP has several functions that allow you to use asynchronous I / O, but you don't need anything like concurrency.
The reason for the lack of language support is that PHP is designed to run short-lived scripts, and concurrency is controlled by the HTTP daemon.
See also:
cur_mult_init
pcntl_fork
Artefecto, , . Google, , , , , .
, .
, , , , .
, PHP . -, , PHP.
startProcess()? .
: , mail(), , ; , . , , cron.
function myFunction() { addToQueue(); return $something; } function addToQueue() { // add stuff to the queue of tasks } function runQueue() { // process the queue of tasks; called by cron. }
Gearman ?
, , ?
http://php.net/manual/en/function.register-shutdown-function.php
Source: https://habr.com/ru/post/1748020/More articles:Массивы в схеме/Memoization - dynamic-programmingЕсть ли хорошее место для обсуждения разработки, связанной с тестированием? - tddJSP + Show bean full example - java2 or more months of viewing, or even a year of viewing in FullCalendar? - fullcalendarAuto attach file in php mail - phpdate / time convert in time with php - dateASP.NET MVC - hiding identifier in URL? - asp.net-mvcEntity Framework 4 загружает запись по ID - c#Winforms preload using stack and hidden form - performanceReliable killing of Windows programs stuck in problem reports - pythonAll Articles