Skip to content
Advertisement

get every words backwards using php

I want to get the text and print every words backwards.

Example: Hello World

Output: World hello

This is my codes so far. It is different, I get output backwards but per string.

JavaScript

OUTPUT of the above code is

dlrow olleh

Please help me guys. Thank you.

Advertisement

Answer

Another way to do it with array_reverse(),

JavaScript

DEMO: https://3v4l.org/ZfEqQ

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement