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