📜  在函数 php 代码示例的循环内返回 false

📅  最后修改于: 2022-03-11 14:53:39.131000             🧑  作者: Mango

代码示例1
$items = ['a' , 'b' , 'c']; 

foreach($items as $item) 
{ 
   if($item == 'a') 
   {
       return true; // the foreach will stop once 'a' is found and returns true. 
   }

   return false; // if 'a' is not found, the foreach will return false.
}