Write a PHP program to check if a given string ends with "on".
<?php function test($s1, $n) { return substr($s1, 0, $n) . substr($s1, strlen($s1) - $n, $n); } echo test("Hello", 1)."\n"; echo test("Python", 2)."\n"; echo test("on", 1)."\n"; echo test("o", 1)."\n";
Sample Output:
Ho Pyon on oo
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