内爆后数组的除法-PHP
为什么我仍然不能除法,如果我除法了,我会得到一个0内爆后数组的除法-PHP,php,arrays,Php,Arrays,为什么我仍然不能除法,如果我除法了,我会得到一个0 exec("snmpget -v 2c -c public $host $oid | cut -d':' -f4 | sed -e 's/^[ ]*//'", $state); print_r($state); $seconds=86400; $current_state=implode($state); print($current_state); $div=($current_state/86400); print($div); 可
exec("snmpget -v 2c -c public $host $oid | cut -d':' -f4 | sed -e 's/^[ ]*//'", $state);
print_r($state);
$seconds=86400;
$current_state=implode($state);
print($current_state);
$div=($current_state/86400);
print($div);
可以采用两个参数
字符串内爆(字符串$glue,数组$pieces)
你在分什么?
内爆()后,$current\u state
的内容是什么?$current\u state
的值是。。。?我们应该猜猜看吗?好啊我猜它真的是“香蕉”,你试着做banana/86400
@MarcB,它等于零…我的exec输出是2569200,我想把它除以86400。我的$current_状态在内爆后我得到了#@MichaelBerkowski:没错。不,它只需要一个数组输入就可以工作。。这就是为什么在你链接到的文档中有内爆($glue,$array)
和内爆($array)
。这就是为什么我说“可以接受两个参数”。不,你说“需要两个参数”直到你忍者编辑。-1不幸的是,说内爆可以取2个参数并不能解决他的问题。内爆是从数组中取实际的#我想要,但当我除以时,我得到0。即使在分割之前打印当前状态,也会得到#本身。