I'm trying to make a PHP function that wraps around a variable that will check the variable value and change it if it matches another variable. I'm sure I'm doing it wrong, but...
Here's what I have so far:
<?php
function Clear_Value(){
$val='NONE';
if(this== $val){ this=='';}
};
$one = 'One';
$two = 'Two';
$three = 'NONE';
$four = 'Four';
Clear_Value($one);
Clear_Value($two);
Clear_Value($three);
Clear_Value($four);
echo $one.'<br>';
echo $two.'<br>';
echo $three.'<br>';
echo $four.'<br>';
?>
The output I'm going for would be:
One
Two
Four
I hope that's clear. I'm still learning functions in php so any pointers would be great.
Thanks
this(which should be$this) within a class.