Relatively new to php just wonder whats the most efficient way to go about this scenario:
I have a variable $x that can be between 0-9 based on what the api gives me.
Id like to display $x as a roman numeral based on what I get back, so would the best solution be to use a switch statement?
<?php
switch ($x) {
case '0':
$xFORMATTED = " I "
case '1':
$xFORMATTED = " II "
case '2':
$xFORMATTED = " III "
etc....
echo ($xFORMATTED)
}
?>
PS. I have alot of variables similar to “x” in the statement above what would be the best way in converting them all to roman numerals based on the apis response.