Write a PHP program to create a new string using the two middle characters of a given string of even length (at least 2).
<?php function test($s1) { return substr($s1, strlen($s1)/2 - 1, 2); } echo test("Hell")."\n"; echo test("JS")."\n"; echo test(" ")."\n";
Sample Output:
el JS
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