$value) { if (strpos($key, 'about') === 0) { $paramKey = $key; if (!isset($dataArray[$paramKey])) { $dataArray[$paramKey] = []; } if (strpos($key, 'OnMain') === false) { $dataArray[$paramKey]['value'] = htmlentities($value); } } } $user = new \App\Models\User(Auth::userid()); $content = json_decode($user->i('content'), true); $existingArray = array_replace_recursive($content, $dataArray); $newJson = json_encode($existingArray, JSON_PRETTY_PRINT); if (isset($_FILES['userphoto'])) { $upload = new UploadPhoto($_FILES['userphoto'], '/cdn/img/'); if ($upload->getType() !== null) { $this->photourl = $upload->getSrc(); } else { $this->photourl = $user->i('photourl'); } } else { $this->photourl = $user->i('photourl'); } DB::query('UPDATE users SET content=:c, photourl=:ph WHERE id=:id', [':id' => Auth::userid(), ':c' => $newJson, ':ph'=>$this->photourl]); } }