K
K
katya_miro19922021-04-29 10:57:39
Algorithms
katya_miro1992, 2021-04-29 10:57:39

Algorithm of the most suitable option?

Which of the $arTwo options is the most suitable in all respects from $arOne?

<?
  $arOne = [
    'length ' => '100',
    'width'   => '200',
    'height ' => '300',
  ];


  $arTwo = [
    '0' => [
      'length ' => '110',
      'width'   => '240',
      'height ' => '360'
    ],
    '1' => [
      'length ' => '90',
      'width'   => '160',
      'height ' => '320'
    ],
    '2' => [
      'length ' => '140',
      'width'   => '210',
      'height ' => '300'
    ],
  ];	
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anar Aghakishiyev, 2021-04-29
@aqakishiyev

Depending on what you think is appropriate. If reading by volume, you just need to multiply the data of each $arTwo and $arOne object. Then get the modulo from subtracting each of $arTwo from $arOne. The smallest value obtained will probably be the most appropriate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question