<?php
$phonesArr = [
    'klaudia mazurkiewicz' => '',
    'monika raczkowska' => '+48 17 859 56 63',
    'kamila wachnicka' => '',
    'adam swider' => '+ 48 538 619 364',
    'grzegorz welc' => ''
];

$user = $_GET['phone'] ?? '';
$response = [];

foreach ($phonesArr as $name => $number) {
    if ($name === $user) {
        $response['phone'] = $number;
        break;
    }
}

header('Content-Type: application/json');
echo json_encode($response);
?>