Home >Backend Development >PHP Tutorial >swoole_process a very strange problem

swoole_process a very strange problem

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-06 13:51:201169browse

$str and $str1 are both arrays, one will report an error when called, and the other will not

<code><?php

$str[] = 'calback_func';
$str1 = ['calback_func'];

//$str[0] 改成 $str1[0] 就会报错
$process = new swoole_process($str[0]);

$pid = $process->start();

function calback_func(swoole_process $worker){// 第一个处理
   echo $worker->callback .PHP_EOL;
}</code>

#Error code

swoole_process a very strange problem

They are all characters, why is this happening....

Reply content:

$str and $str1 are both arrays, one will report an error when called, and the other will not

<code><?php

$str[] = 'calback_func';
$str1 = ['calback_func'];

//$str[0] 改成 $str1[0] 就会报错
$process = new swoole_process($str[0]);

$pid = $process->start();

function calback_func(swoole_process $worker){// 第一个处理
   echo $worker->callback .PHP_EOL;
}</code>

#Error code

swoole_process a very strange problem

They are all characters, why is this happening....

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn