preg_replace基于php中的条件逻辑

时间:2017-09-17 14:29:42

标签: php arrays regex preg-replace

我有一个大型数组,默认保存在db.i中的某些值想要提取excel / CSV中的所有数据。

echo '<pre>'
$third_guest_array=[
  'add_3rd_guest?'  // this is radio button if user select "No" options then their salutation must be blank in excel or csv. without update in database
       ];
if(in_array($value,$third_guest_array)){

                    if($value=='No') { 
                         $default_array_value=[
                                 'third_guest_salutation',  // this field value by default store salutation e.g Mr,Dr in db
                                ];
                    $value=in_array($field,$default_array_value);
                       #$value = preg_replace('/\bDr\b/', '', in_array($value,$default_array_value));
                       $value = preg_replace('/\bDr\b/', '',$value);
                    }
                }

但是我得到了这个输出

This gives me the following result:

以下是我想要的结果:

Below is my desired result

0 个答案:

没有答案