Remove empty array elements

前端 未结 27 3408
半阙折子戏
半阙折子戏 2020-11-21 23:17

Some elements in my array are empty strings based on what the user has submitted. I need to remove those elements. I have this:

foreach($linksArray as $link)         


        
27条回答
  •  不思量自难忘°
    2020-11-22 00:04

    try this ** **Example

    $or = array(
            'PersonalInformation.first_name' => $this->request->data['User']['first_name'],
            'PersonalInformation.last_name' => $this->request->data['User']['last_name'],
            'PersonalInformation.primary_phone' => $this->request->data['User']['primary_phone'],
            'PersonalInformation.dob' => $this->request->data['User']['dob'],
            'User.email' => $this->request->data['User']['email'],
        );
    
    
    
     $or = array_filter($or);
    
        $condition = array(
            'User.role' => array('U', 'P'),
            'User.user_status' => array('active', 'lead', 'inactive'),
            'OR' => $or
        );
    

提交回复
热议问题