Problem:- How to Reverse Word in a String Using PHP?
Solution
There are to Method to reverse a string
Method 1 – How to Reverse Word in a String Using PHP?
To reverse every Word
<?php $string = "Hindi Alerts"; $words = explode(' ', $string); $words = array_reverse($words); $string = implode(' ', $words); echo $string; ?>
Method 2 – How to Reverse Word in a String Using PHP?
To reverse every character
<?php $string = "Hindi Alerts"; $rev_string = strrev($string); echo $rev_string; ?>
इसे भी पढ़े – च्यवनप्राश खाने के Benefits और Side Effects