I was wondering if it could be possible to make a substitution between the values of two variables, in PHP.
I can explain it better:
<?php
$a = "Cat";
$b = "Dog";
// The strange/non-existent function I am talking about //
MakeSubstitution($a, $b);
// After this (non-existent) function the values of the variables should be:
// $a = "Dog"
// $b = "Cat"
?>
So, does it exist? I made searches but I found no results. Thanks in advance.
Try this :
$a = "Cat";
$b = "Dog";
list($a,$b) = array($b,$a);
echo $a;
echo $b;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With