How to call a function asynchronously in PHP?

Let’s learn how to call a function asynchronously in PHP. The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

How to call a function asynchronously in php

I want to execute these functions when user click on button but I want to execute $model->user->email ? $model->sendUserMail(): ""; that function asynchronously in background while other function will execute as click occur Here is my code if (isset($_POST['create_send'])) { if ($model->save()) { $model->order_id = strtotime(date("Y-m-d H:i:s")) + '' + $model->id; // send mail $model->sendMail(); //send sms $messages = $model->sendSMSMessage...

Answer:

There is nothing like Async Tasks in Standard PHP. You could install pthreads or you have to work with...

Read more

Himanshu Gupta at Stack Overflow Mark as irrelevant Undo

Other solutions

How do I call a plugin function inside a PHP template for WP sites?

I am using a pagination plugin in my WP site. As pagination works, it  must be laid inside an index.php file, else it will not show the output.  But i wish to call the same function in a template file. I have the php  code but when I call that function...

Answer:

Just  a simple suggestion that instead of making multiple copies of same  function, why not create a...

Read more

Rahul Balakrishna at Quora Mark as irrelevant Undo

How can I mix javascript and php? With one button I want it to call a php function as well as a javascript function?

I am really struggling with this. If I use a submit button and then say: <?php if isset($_POST['buttonName']){ ?> call some javascript function. <?php } ?> The above code does not work properly. if do an onclick for the submit button...

Answer:

I would like you to go through Browser — Server Communication good discussion on this. What...

Read more

Ashish Kasama at Quora Mark as irrelevant Undo

How can I call a Function in another php file? I'm pretty new in PHP.?

I have this codes: /*my another php file*/ <?php myfunction(param1,param2){ /-----/ return myresult; } ?> Now, how i call it from my main php page,a nd get the result of my function?

Answer:

<?php require("mainfile.php"); function myfunction($param1, $param2) { return mainfilesfunction...

Read more

jay at Yahoo! Answers Mark as irrelevant Undo

PHP how to use echo and then call a function?

How to make an echo to call a function example : <?php ob_start(); session_start(); $applications=getApplication($_SESSION… $count=mysql_numrows($applications); if($count==0) { echo "You dont have any applications submited"; } else...

Answer:

If I understood your problem correctly, you need to do it the same way you used nl2br in echo statement...

Read more

Alvin at Yahoo! Answers Mark as irrelevant Undo

I have a JavaScript function from which I need to call a PHP function written in a separate file. How can I do this?

The PHP function returns a value that I want to assign to a JavaScript variable.

Answer:

Assuming you can modify the code in both files: Turn the PHP function into a web service which accepts...

Read more

Bulat Bochkariov at Quora Mark as irrelevant Undo

Answer:

You would have to do this using an AJAX request. The onchange event would trigger a Javascript function...

Read more

wiki.answers.com Mark as irrelevant Undo

Answer:

Hi mani! U cant call a php function from a javascript. Javascript is a client side scripting language...

Read more

Mani at Yahoo! Answers Mark as irrelevant Undo

Answer:

A simple google search yielded this - http://stackoverflow.com/questio... But IMHO, it is better to...

Read more

Raghavendra Kidiyoor at Quora Mark as irrelevant Undo

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.