File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ // htmlspecialchars
3
+
4
+ /*
5
+ Convert special characters to HTML entities
6
+ e.g. :
7
+ "<" convert to "<"
8
+ ">" convert to ">"
9
+ ...
10
+ */
11
+ $ str = "The word <b>text</b> is bold " ;
12
+ echo htmlspecialchars ($ str );
13
+ // HTML output will be "The word <b>text</> is bold"
14
+
15
+ $ str = "My name is 'Ali' " ;
16
+ echo htmlspecialchars ($ str );
17
+
18
+ $ str = "What is decrement & increment ? " ;
19
+ echo htmlspecialchars ($ str );
Original file line number Diff line number Diff line change
1
+ <?php
2
+ // stripslashes
3
+
4
+ /*
5
+ # Remove backslashes
6
+ This function can be use for clean data received
7
+ from user.
8
+ */
9
+ $ str = "Hello \ my name \ is Ali " ;
10
+ var_dump (stripslashes ($ str ));
11
+
12
+ // and can be use for ignore escape sequences
13
+ $ str = "Wellcome \n This is world " ;
14
+ var_dump (stripslashes ($ str ));
You can’t perform that action at this time.
0 commit comments