AJUTOR! Calculator incadrare in coala
Moderatori: Moderatori, Start Moderator
- vectorialpx
- Senior Member
- Mesaje: 4832
- Membru din: Mar Mar 01, 2005 9:48 am
- Localitate: Bucuresti
- Contact:
well, nu esti pe chat, sa ti se raspunda instant
Ca fapt divers, X si Y sunt identificatoare pentru pozitie
Duda-n gura
[php]<?php
error_reporting(E_ALL);
// dimensiuni
$A = array(
array('W' => 210, 'H' => 297, 'format' => 'A4'), // 16
array('W' => 210, 'H' => 148.5, 'format' => 'A5') // 8
);
// produse
$produsW = 50;
$produsH = 80;
function getXY ($elementW, $elementH, $contentW, $contentH, $margin = 0) {
$peH = floor($contentW/($elementW+$margin));
$peV = floor($contentH/($elementH+$margin));
return $peH*$peV;
}
foreach($A as $dimensiuni) {
echo 'Pe '.$dimensiuni['format'].' incap '.getXY ($produsW, $produsH, $dimensiuni['W'], $dimensiuni['H']).'<br />';
}
// =>
// Pe A4 incap 12
// Pe A5 incap 4
?>[/php]
Ca fapt divers, X si Y sunt identificatoare pentru pozitie
Duda-n gura
[php]<?php
error_reporting(E_ALL);
// dimensiuni
$A = array(
array('W' => 210, 'H' => 297, 'format' => 'A4'), // 16
array('W' => 210, 'H' => 148.5, 'format' => 'A5') // 8
);
// produse
$produsW = 50;
$produsH = 80;
function getXY ($elementW, $elementH, $contentW, $contentH, $margin = 0) {
$peH = floor($contentW/($elementW+$margin));
$peV = floor($contentH/($elementH+$margin));
return $peH*$peV;
}
foreach($A as $dimensiuni) {
echo 'Pe '.$dimensiuni['format'].' incap '.getXY ($produsW, $produsH, $dimensiuni['W'], $dimensiuni['H']).'<br />';
}
// =>
// Pe A4 incap 12
// Pe A5 incap 4
?>[/php]
- vectorialpx
- Senior Member
- Mesaje: 4832
- Membru din: Mar Mar 01, 2005 9:48 am
- Localitate: Bucuresti
- Contact:
Cine este conectat
Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 22 vizitatori