Create a php user defined function called MinMax. The function accepts two numbers as arguments and it returns the string: "The minimum number is x and the maximum number is y" where x and y are the minimum and the maximum numbers respectively. For example, if the numbers 20 and 4 are passed to the function MinMax, it should return the string:

Respuesta :

Answer:

<?php

function MinMax($x,$y) {

 if($x > $y){

     echo("The minimum is ".$y." and the maximum number is ".$x);

 }

 else{

   echo("The minimum is ".$x." and the maximum number is ".$y);    

 }

}

MinMax(20,4);

?>

Explanation:

<?php

This defines the user function with two parameters x and y

function MinMax($x,$y) {

This checks if parameter x is greater than parameter y

 if($x > $y){

If yes, it prints x as the maximum and y as the minimum

     echo("The minimum is ".$y." and the maximum number is ".$x);

 }

If otherwised

 else{

If yes, it prints y as the maximum and x as the minimum

   echo("The minimum is ".$x." and the maximum number is ".$y);    

 }

}

This calls the function

MinMax(20,4);

?>