Write a PHP program to create a new string with the last char added at the front and back of a given string of length 1 or more.
<?php function test($str) { $s = substr($str, strlen($str) - 1); return $s.$str.$s; } echo test("Red")."\n"; echo test("Green")."\n"; echo test("1")."\n";
Sample Output:
dRedd nGreenn 111
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer