Run a PHP script every 40 milliseconds?

Is there a way to execute a PHP script every 40 milliseconds? I don’t know if cronjob is suitable, because 25 CPUs are required a lot.

Well, if php is not the right language, which language should I use?

I am making an online game, but I need to process something that happens in the game, move characters, calculate the paths of shells, etc.

+3
source share
8 answers

If you try to call a PHP script every 40 milliseconds, this will include:

  • Process creation
  • Download PHP
  • Download and compile script
  • Run the compiled script
  • Delete process and all memory

, time_sleep_until 40 . PHP .

, PHP; - - , script.

+13

40 . cron, 1- .

, , , .

, , - , UNIX - , 40 .

. - , , .

, ( ) , , .

, , , .

+6

PHP - , . . PHP script 40 . , PHP, , . ?

+5

, cronjob . . , ?

+1

, 40 . , . , - 40 ? , , , .

, , , . , Java, Python.

0

, 40 MS , , . , N , 40 MS, , . , , .

PHP, , . :

  • PHP . , N .

  • , .

C Python , . " " N 40 MS, , . , , , , .

, , " ".. . , PHP.

0

PHP is the wrong language for this to work. If you want to update something quickly in the browser, you need to use Javascript. PHP is intended for the backend only, which means that everything that PHP needs to be sent from your server to the browser and then displayed.

0
source

Source: https://habr.com/ru/post/1723587/


All Articles