PHP – array of 5 integers, permute into equations and check results

I am currently trying to make a PHP program that when run will take a string with 5 numbers(in this example the possible values in the string at the start are 1 to 52), convert the string into an array of 5 elements. From here i want to use either (+ , – , or *) to see if the 5 numbers can make a set value of 42.

current code for array:

<?php
$randomNumbers = array_map('intval', explode(',', $string));

for ($i = 0; $i <= 4; $i++)
  {
    
  }
  
  
  echo $randomNumbers
?>

However, i do not understand how to test all the possible values against the 3 different mathematical functions, without writing hundreds of lines.

I tried writing a for loop for the 5x3x4x3x2x3x1 = 1080 possibilities, however i also am unaware of any way to iterate between the different mathematical functions.

would anyone be able to provide me with some further insight on this topic.

Thanks.