$array= array(1,2,3,4,5);
$query = "INSERT INTO `table`(nomer) VALUES ";
foreach ($array as $i=>$value) {
$query .= "({$value})";
if ($i+1 < count($array)) {
$query .= ", "
}
} // Result query: INSERT INTO `table`(nomer) VALUES (1), (2), (3), (4), (5)
$res = mysql_query($query);
<?
class City {
private $length;
function __construct($length) {
$this->length = $length;
}
public function getLength() {
return $this->length;
}
}
class Auto {
private $speed;
function __construct($speed) {
$this->speed = $speed;
}
public function getSpeed() {
return $this->speed;
}
public function howLongToGo($length) {
return $length / $this->speed;
}
public function howLongToGoThrowCity(City $city) {
return $city->getLength() / $this->speed;
}
}
$a = new Auto(20);
$c = new City(100);
print $a->howLongToGo($c->getLength());
// Или так
print $a->howLongToGoThrowCity($c);
class Result
{
private $result;
function __construct(...)
{
$this->result = ...;
}
public function Calc()
{
...
}
}