Write a PHP program to check if a given string starts with 'C#' or not.
<?php function test($str) { return (strlen($str) < 3 && $str=="C#") || (substr($str,0,2) == "C#" && substr($str,2,1) == ' '); } var_dump(test("C# Sharp")); var_dump(test("C#")); var_dump(test("C++"));
Sample Output:
bool(true) bool(true) bool(false)
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: