<?php
class Worker
{
public function __construct($salary, $coffee, $reports)
{
$this->salary = $salary;
$this->coffee = $coffee;
$this->reports = $reports;
}
}
500,
20,
200
);
400,
15,
150
);
200,
5,
50
);
800,
50,
5
);
function doShit($array)
{
foreach ($array as $k => $v) {
if ($k == 0) {
$k1 = $v;
} elseif ($k == 1) {
$k2 = $v;
} elseif ($k == 2) {
$k3 = $v;
}
}
$worker = new Worker($k1, $k2, $k3);
$workers[] = $worker;
return $workers;
}
doShit($me);
PD9waHAKCm1iX2ludGVybmFsX2VuY29kaW5nKCJVVEYtOCIpOwoKY2xhc3MgV29ya2VyCnsKICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkc2FsYXJ5LCAkY29mZmVlLCAkcmVwb3J0cykKICAgIHsKICAgICAgICAkdGhpcy0+c2FsYXJ5ICA9ICRzYWxhcnk7CiAgICAgICAgJHRoaXMtPmNvZmZlZSAgPSAkY29mZmVlOwogICAgICAgICR0aGlzLT5yZXBvcnRzID0gJHJlcG9ydHM7CiAgICB9Cn0KJG1lID0gYXJyYXkoCiAgICA1MDAsCiAgICAyMCwKICAgIDIwMAopOwokbWEgPSBhcnJheSgKICAgIDQwMCwKICAgIDE1LAogICAgMTUwCik7CiRlbiA9IGFycmF5KAogICAgMjAwLAogICAgNSwKICAgIDUwCik7CiRhbiA9IGFycmF5KAogICAgODAwLAogICAgNTAsCiAgICA1Cik7CmZ1bmN0aW9uIGRvU2hpdCgkYXJyYXkpCnsKICAgICR3b3JrZXJzID0gYXJyYXkoKTsKICAgIGZvcmVhY2ggKCRhcnJheSBhcyAkayA9PiAkdikgewogICAgICAgIGlmICgkayA9PSAwKSB7CiAgICAgICAgICAgICRrMSA9ICR2OwogICAgICAgIH0gZWxzZWlmICgkayA9PSAxKSB7CiAgICAgICAgICAgICRrMiA9ICR2OwogICAgICAgIH0gZWxzZWlmICgkayA9PSAyKSB7CiAgICAgICAgICAgICRrMyA9ICR2OwogICAgICAgIH0KICAgICAgICAKICAgIH0KICAgICR3b3JrZXIgICAgPSBuZXcgV29ya2VyKCRrMSwgJGsyLCAkazMpOwogICAgJHdvcmtlcnNbXSA9ICR3b3JrZXI7CiAgICByZXR1cm4gJHdvcmtlcnM7Cn0KZG9TaGl0KCRtZSk7CnZhcl9kdW1wKCR3b3JrZXJzKTs=