forked from assembler-institute/php-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.php
More file actions
62 lines (36 loc) · 911 Bytes
/
strings.php
File metadata and controls
62 lines (36 loc) · 911 Bytes
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
print "Print a text string";
echo "<br><br>";
$string = "Esto es una variable";
print($string);
echo "<br><br>";
print($string. " / Print a text string");
echo "<br><br>";
#replace
$city = "Estoy en Madrid";
print_r(str_replace("Madrid", "Barcelona", $city));
echo "<br><br>";
#ireplace
$city = "Estoy en Madrid";
print_r(str_ireplace("mADRID", "Paris", $city));
echo "<br><br>";
#Repeat
$repeat = "OoO ";
echo str_repeat($repeat, 20);
echo "<br><br>";
#length
$length = "hr r f d ee d f ttg h yuuih edgt";
echo strlen($length);
echo "<br><br>";
#Posicion de una palabra
echo strpos("Me encanta el php","php");
#Poner en mayuscula
echo strtoupper("me encanta php(mayuscula)");
echo "<br><br>";
#Poner en minuscula
echo strtolower("ME ENCANTA PHP(MINUSCULA)");
echo "<br><br>";
#Quitar y poner letras en una frase
$hola = "Hola mi nombre es Victor";
echo substr($hola, 6, -1);
?>