将nodeValue与Switch Case匹配

I am having some trouble to matching nodeValue which is $property and $value. it's actually must go smoothly but I am making mistake somewhere. I couldn't figure put.

foreach ($links as $getContent){
        $getContentData = pageContent($getContent);
        $getRouteData = new \DOMXPath($getContentData);

        $sendtoDatabase = [
            'region' => '関西',
            'photo' => $images,
            'building_name' => '',
            'price' => '',
            'old_price' => '',
            'extend' => '',
            'address' => '',
            'total_house' => '',
            'rooms' => '',
            'cons_finish' => '',
            'entry' => '',
            'balcony' => '',
            'company_name' => '',
            'date_update' => '毎週月曜日更新',
        ];


        $tableth = $getRouteData->query("//table[@class='outline']/tr/th");
            foreach ($tableth as $getth){
                $property[] = trim($getth->nodeValue);
            }


        $tabletd = $getRouteData->query("//table[@class='outline']/tr/td");
            foreach ($tabletd as $gettd){
                $value[] = trim($gettd->nodeValue);
            }

            switch ($property) {
                case '物件名':
                    $sendtoDatabase['building_name'] = $value;
                    break;
                case '販売価格':
                    $sendtoDatabase['price'] = $value;
                    break;
                case '専有床面積':
                    $sendtoDatabase['extend'] = $value;
                    break;
                case '所在地':
                    $sendtoDatabase['address'] = $value;
                    break;
                case '総戸数':
                    $sendtoDatabase['total_house'] = $value;
                    break;
                case '間取り':
                    $sendtoDatabase['rooms'] = $value;
                    break;
                case '竣工日':
                    $sendtoDatabase['cons_finish'] = $value;
                    break;
                case '管理形態':
                    $sendtoDatabase['company_name'] = $value;
                    break;
                case '入居開始日':
                    $sendtoDatabase['entry'] = $value;
                    break;
                case 'バルコニー面積':
                    $sendtoDatabase['balcony'] = $value;
                    break;
                default:
                    break;
            }
} 

Datas are contained in $property and $value. No problem with that I checked it. Just can't pass it to switch case for a matching. Any idea why is this happening.

I would suggest that you make another empty variable $new_variable = [];(this will define variable $new_variable as an array. you can make it like this aswell $new_variable = array();) before you first foreach loop(at the begining of your code you posted here).

After your switch fill $new_variable like this(ill give an example:

switch ($property) {
            case '物件名':
                $sendtoDatabase['building_name'] = $value;
                break;
            case '販売価格':
                $sendtoDatabase['price'] = $value;
                break;
            case '専有床面積':
                $sendtoDatabase['extend'] = $value;
                break;
            case '所在地':
                $sendtoDatabase['address'] = $value;
                break;
            case '総戸数':
                $sendtoDatabase['total_house'] = $value;
                break;
            case '間取り':
                $sendtoDatabase['rooms'] = $value;
                break;
            case '竣工日':
                $sendtoDatabase['cons_finish'] = $value;
                break;
            case '管理形態':
                $sendtoDatabase['company_name'] = $value;
                break;
            case '入居開始日':
                $sendtoDatabase['entry'] = $value;
                break;
            case 'バルコニー面積':
                $sendtoDatabase['balcony'] = $value;
                break;
            default:
                break;
        }

  //right here BEFORE you close the foreach loop fill $new_variable 
 //with the new value like this
$new_variable[] = $sendtoDatabase;//the '[]' brackets means that each 
//$sendtoDatabase will be inserted into $new_variable[0], then 
//$new_variable[1], and so on untill the last foreach loop

now AFTER the foreach() ended do a piece of code like this

foreach($new_variable as $value){
   //add each $value into the database. this will take each looped foreach and 
  //switch you used before and add them one by one to the database
}

I hope this helps if you have any other questions just ask:D i will try to help as much as i can!