I am trying to get PHP to configure some array values ββso that in all instances of objects passing through the functionality, it compares the length and height of the length of these array values ββand aligns them as best as possible.
Imagine 3 cigarette boxes. They have the same size, shape and volume, but one rises, one lies flat and the other is on the short side.
Then imagine a 4th cigarette box. It is the same length and width as other packages, however it has more packs of cigarettes inside the container, which makes it height (or width / length, depending on user input) for other packages.
The function should still try to orient the package to the source package in the array.

. , , . , , , , , 2 . 3 , , , , , .
PHP-, .
, array_diffs array_intersects, , , 1 .
UPDATE:
, , 3 . .
, , , . , 1 2 ...
... ...
<?php
$params['object'] = array();
$params['object'][] = array( 'height'=>'30',
'width'=>'10',
'length'=>'20');
$params['object'][] = array( 'height'=>'20',
'width'=>'30',
'length'=>'30');
echo '<PRE>';
echo 'INPUT<BR>';
print_r($params['object']);
$rotated = array();
foreach($params['object'] as $on=>$outer){
if(in_array($on,$rotated)){ continue; }
$rotated[$on] = $on;
if($oo['width']==$oo['length'] && $oo['length']==$oo['height']){ continue; }
$oo = array('width'=>$outer['width'],
'length'=>$outer['length'],
'height'=>$outer['height']);
foreach($params['object'] as $in=>$inner){
if(in_array($in,$rotated)){ continue; }
if($in==$on){ continue; }
$ii = array('width'=>$inner['width'],
'length'=>$inner['length'],
'height'=>$inner['height']);
$rotated[$in] = $in;
}
}
echo 'OUTPUT<BR>';
print_r($params['object']);
?>