-
Notifications
You must be signed in to change notification settings - Fork 0
/
strings_functions.php
44 lines (42 loc) · 1.33 KB
/
strings_functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html>
<head>
<title> String functions </title>
</head>
<body>
<?php
$firstString = "The quick brown fox";
$secondString = " jumped over the lazy dog.";
?>
<?php
$thirdString = $firstString;
//concernating strings using variables
$thirdString.=$secondString;
echo $thirdString;
?>
<br>
Lowercase: <?php echo strtolower($thirdString); ?>
<br>
Uppercase: <?php echo strtoupper($thirdString); ?>
<br>
Upperfirst: <?php echo ucfirst($thirdString); ?>
<br>
Upperwords: <?php echo ucwords($thirdString); ?>
<br>
Length: <?php echo strlen($thirdString); ?>
<br>
Trim: <?php echo $fourthString = $firstString.trim($secondString); ?>
<br>
Replace: <?php echo str_replace("quick", "super star",$thirdString); ?>
<br>
Find: <?php echo strstr($thirdString,"brown"); ?>
<?php echo "<br>For more string functions" ?>
<br>
Repeat: <?php str_repeat($thirdString,2); ?>
<br>
Make substring: <?php echo substr($thirdString,4,10); ?>
<br>
Find Position: <?php echo strpos($thirdString,"brown"); ?>
<br>
Find character: <?php strchr($thirdString,"z") ?>
</body>
</html>