Reputation: 189
Hi I have a number in php, and I need to flip it (eg. "1112"-->"2111"). How can this be performed? Should I use an array, or is there a special function?
Upvotes: 0
Views: 173
Reputation: 7768
Using JAVASCRIPT
function strrev(str)
{
return str.split("").reverse().join("");
}
alert(strrev("1112"));
Using PHP
echo strrev("1112");
Upvotes: 0
Reputation: 520
You use the following strrev function in PHP.
$reverse = strrev("1112")
Upvotes: 3