<?php


$csv = fopen('session.csv', 'r+');

$aCsv = [];
while ($f = fgetcsv($csv, null, ';')) {
    $aCsv[] = $f;
}

$aRooms = [];
foreach ($aCsv as $row) {
    if ($row[2] == $_POST['floor']) {
        $aRooms[] = [
            'name' => $row[0],
            'room' => $row[1],
            'description' =>str_replace( '<br />', PHP_EOL, $row[3] ),
            'elevator' => (int) $row[4]
        ];
    }
}

echo json_encode($aRooms);