Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function RevertString.m that accepts a string as its argument and return

ID: 671133 • Letter: W

Question

Write a function RevertString.m that accepts a string as its argument and returns a string that’s a reverted version of that string (string obtained by flipping the argument string i.e. making the last character of the argument string first in the output string, second to last character of the argument string should become the second character of the output string and so on, with your last character of the output string being the first character of the argument string). For example A=RevertString(‘Dragan’) should give you a string A that is equal to ‘nagarD” or B=RevertString(‘olleH’) should give you a string B that is equal to ‘Hello’.

Explanation / Answer

<?php

$a="Dragan";
$b='olleH';
echo strrev($a);
echo strrev($b);
?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote