I am sure there are lots of people who have the same queries, I want to execute 2 lines same time. not the 2 scripts same time using PHP coding. for example, I have a file that I have to send to google API for the speech recognition, and at the same time I want to execute another line and I don't want my program to wait for the API to give a response and then execute.
$recording_file = '/opt/sounds/recoginze.wav';
exec("gcloud ml speech recognize $recording_file --language-code='en-US'",$output,$retval);
$transcript = $output['6'];
Normally above statement will take 3 to 4 seconds to respond, I want the other line to execute simultaneously like play recording.
$play_sound = playSound($recording_file);
Let me know your inputs and ideas.
Note: I am no programmer in PHP, I am just a sysadmin, who trying to learn PHP.
My Answer:
"python speech_recognition.py $recording_file &");_exec("echo 'Executing another line simultaneously'");
Rate this post
3 of 5 based on 8136 votesComments