Reversing a string in various programming language

R

Reversing is a common task in programming. Different language handle this common task differently. I try to figure it out in one place

PHP:

$a = "Hello World!!!";
echo strrev($a);

Python:

a= "Hello World!!!"
print(a[::-1])

JavaScript:

var word = "Hello World!!!";
console.log(word.split("").reverse().join(""));

About the author

Imran Pollob

Learn => Practice => Implement => Repeat

Add comment

Categories

Imran Pollob

Learn => Practice => Implement => Repeat

Get in touch