Total NEWB - php function if variable is null

Wrakcruch

New Member
sorry for asking this dumb question i will try to explain as good as i can, i have never done a php function before, i could solve this with IF but i want to do my first function What i want to do is to see if the variable is null and if it is i want to set the variable to be "N/A"\[code\]$carplate=mysql_result($result,0,"plate");$carbrand=mysql_result($result,0,"brand");function set_null(variablegoeshere?){ if($WHATiWANTtonull==null){$WHATiWANTtonull="N/A";}else{ do nothing }}set_null($carplate);set_null($carbrand);echo "carplate = $carplate | carbrand = $carbrand";\[/code\]i dont understand how i will get the function to set a variable to "N/A" or do nothing, i don't want it to echo something, just set a variable and i can echo it later whenever i want
 
Back
Top