<?php
//2- referencial => &
function trocarValorComReferencial (&$a, &$b) {
$seguraValor = $a;
$a = $b;
$b = $seguraValor;
}
//input de valores que serão referenciados a $a e $b
$valorReferencia_a = (int) trim(fgets(STDIN));
$valorReferencia_b = intval(trim(fgets(STDIN)));
//chamada da função que será executada com valores fornecidos no input
trocarValorComReferencial($valorReferencia_a, $valorReferencia_b);
echo "Os valores trocados de A e B são respectivamente: $valorReferencia_a e $valorReferencia_b.\n";
//trocarValorComReferencial($a, $b);
//echo $a, $b;
?>
To embed this project on your website, copy the following code and paste it into your website's HTML: