我有一个返回数组的函数$statusall = Getstatusall();阵列如下所示$statusall = ['inprogress', 'complete', 'Failed', 'inprogress', 'staring'];我想循环使用Getstatusall函数,直到所有数组值都“完成”或“失败”,我应该如何在PHP中执行此操作?
1 回答

拉莫斯之舞
TA贡献1820条经验 获得超10个赞
此示例在函数返回值不是 或 的数组时回显。There are values not complete or failed. Repeat.Getstatusall()completefailed
while( array_diff( Getstatusall(), ['complete', 'failed'] ) ) {
echo "There are values not complete or failed. Repeat.";
// you can even do something else or nothing
}
如果要获取 ,这可能会有所帮助:final result
while( array_diff( $status = Getstatusall(), ['complete', 'failed'] ) ) {
echo "There are values not complete or failed. Repeat."
// you can even do something else or nothing
}
var_dump( $status );
- 1 回答
- 0 关注
- 103 浏览
添加回答
举报
0/150
提交
取消