gpt4 book ai didi

php - array_filter的回调函数内非空数组变为null

转载 作者:行者123 更新时间:2023-12-02 20:46:34 24 4
gpt4 key购买 nike

我正在尝试比较数组内的值,该值是在调用 array_filter 之前初始化的。

当控制流进 array_filter 的回调函数时,数组不为空,但变为 null。这可能是什么原因?

$stream = $stream_list[$i]['@attributes']; // IS ARRAY

$chargeable_feature = array_filter($applicable_conversions,function($conversion) {
return $conversion['FeatureName'] == $stream['FeaturesUsed'];
// STREAM BECOMES NULL HERE
});

最佳答案

$stream = $stream_list[$i]['@attributes']; // IS ARRAY

$chargeable_feature = array_filter($applicable_conversions,function($conversion) use ($stream) {
return $conversion['FeatureName'] == $stream['FeaturesUsed'];
});

关于php - array_filter的回调函数内非空数组变为null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39122395/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com