How to implement this code in php class and return in js?

here is a simple code which need to put into a class and return in jquery?
can anyone suggest or throw an example?
<?php
$first = $_GET['coin_two'];
$last = $_GET['coin'];
$give = $_GET['give'];
$res = file_get_contents("https://bittrex.com/api/v1.1/public/getorderbook?market=$first-$last&type=both");
$array = json_decode($res, true);
$val = $array['result']['buy'][0]['Rate'];
//$val = intval($val);
$value = ($give*$val)*0.96;
print_r($value);
?>
June 10th 19 at 14:46
1 answer
June 10th 19 at 14:48
:):):):):)
UPD: the Code below of course a joke :)

<?php
// Ordered class
Any class
{
 public function any()
{
 $first = $_GET['coin_two'];
 $last = $_GET['coin'];
 $give = $_GET['give'];
 $res = file_get_contents("https://bittrex.com/api/v1.1/public/getorderbook? market=$first-$last&type=both");
 $array = json_decode($res, true);
 $val = $array['result']['buy'][0]['Rate'];
 //$val = intval($val);
 $value = ($give*$val)*0.96;
 return $value;
}
}

$obj = new Any();
?>

the <script>
 // Ordered JQuery
$(document).ready(function(){
 alert('<?php print_r($obj->any());?>');
});
</script>

Find more questions by tags jQuery