Open ralferlebach opened 1 month ago
Tests sind noch nicht grün:
@ralferlebach die Tests hab ich erstellt aber grün sind sie noch nicht. Ich hab im obigen Kommentar den Output von PHPUnit mit angegeben. Ich nehme an, dass du das schneller beheben kannst als ich - kannst du dir das ansehen?
@ralferlebach das ist vielleicht etwas unter gegangen. hast du hierfür evt. schon funktionen erstellt?
// Simple case: int, float, linear indexed array, linear assoc array: $data = 9; $data = 9.2; $data = [7, 8, "9.3"]; $data = ['first' => 3, 'second' => -5, 'third' => 7.5];
// Complex cases: nested array, modified and reordered array: $data = [5, 'stairways' => 20, 'first floor' => ['kitchen' => 6, 'dining' => 15, 'wash room' => 4], 'second foor' => ['sleeping room' => 12, 'hobby room' => ['TV corner' => 4.5, 'karaoke box' => 5.3]], 'basement' => 25.7]; $data = ['first' => 2, 'second' => [1 => 7, 3 => 9], 'third' => 5]; $data[0] = 0; $data['second'][2] = 8;
// Forbidden cases: strings in array, empty arrays: $data = ['test' => "test", 'legid' => 3]; $data = ['test' => []];
Der Aufruf
$structure = array_to_vector ($data); $data = vector_to_array ($data, $structure);
muss das Ausgangs-Array $data wiederherstellen.