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

**URL:** <https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912>\
**Category:** Beginners - Learning PHP\
**Created:** [November 14, 2012, 5:27pm UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912 "2012-11-14T17:27:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shibomaru](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@shibomaru](https://www.phphelp.com/u/shibomaru)\
**Post date:** [November 14, 2012, 5:27pm UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912/1 "2012-11-14T17:27:11Z")

</div>

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 = "test@test.com";  
$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](http://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.

---

<div class="post-metadata">

**Author:** ![wilson382](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wilson382](https://www.phphelp.com/u/wilson382)\
**Post date:** [November 14, 2012, 6:38pm UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912/2 "2012-11-14T18:38:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![shibomaru](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@shibomaru](https://www.phphelp.com/u/shibomaru)\
**Post date:** [November 16, 2012, 3:16am UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912/3 "2012-11-16T03:16:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![m11](https://www.phphelp.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@m11](https://www.phphelp.com/u/m11)\
**Post date:** [November 16, 2012, 5:19am UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912/4 "2012-11-16T05:19:50Z")

</div>

I’m also confused about the goal here ☹

---

<div class="post-metadata">

**Author:** ![wilson382](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/ed655f/32.png) [@wilson382](https://www.phphelp.com/u/wilson382)\
**Post date:** [November 16, 2012, 4:17pm UTC](https://www.phphelp.com/t/help-write-php-code-utilizing-10-string-functions-with-a-string-from-user-input/18912/5 "2012-11-16T16:17:20Z")

</div>

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?
