Help write php code utilizing 10 string functions with a string from user input.

I need help on writing this code, since I’m a beginner, because my teacher don’t really teach anything, nor go into full details or give examples of these type of codings, but I saw some examples of some string functions, like these:

similar_text($string1, $string2, $percent)
$real_username =“Bill Gates”;
$user_attempt = “Bill Bates”;
$check = similar_text($real_username, $user_attempt, $percent);
print($check) . “
”;
print($percent . “% correct”);

$extra_dollars = str_repeat("$", 9);
print $extra_dollars;

str_replace($look_for, $change_to, $search_text, match_count);
$search_text = “The explore function”;
$look_for = “explore”;
$change_to = “explode”;

print $search_text . “
”;
$changed_text = str_replace($look_for, $change_to, $search_text);
print $changed_text;

str_word_count(string, return ,char)
$num_of_words = str_word_count(“The word count function”);
print $num_of_words;

$string_length = strlen(“This is some text”);
substr(string, start, length)
$email = "[email protected]";
$email_end = substr($email, strlen($email) - 4);
if ($email_end = = “.com” ) {
print “ends in .com”;
}
else {
print “doesn’t end in .com”;
}

$email_address = “me” . chr(64) . “me.com”;
print $email_address;

$ascii_num = ord("@");
print $ascii_num;

$display_data = “something to display”;
print $display_data;
echo $display_data;

All of the 9 string function examples I put above are different, I don’t know how to make 10 of them with a string from user input, can someone please help? Thanks.

What do you want to make? what will the function do ?

I just need to see a code that uses any 10 string functions with a string from a user input because I don’t know how to put them all together and print those 10 functions

I’m also confused about the goal here :frowning:

well first of all, none of the codes you posted is a function. they are just different lines of codes that do different things. if you want to know what line does what i can do that.

or do you want to make a function out of those codes?

and what will the function do?

Sponsor our Newsletter | Privacy Policy | Terms of Service