In this video, I'll show you the varous ways of adding comments to PHP scripts.
Below are several comments:
HTML: ;
CSS :/**/;
JS ://,/**/;
PHP :#,//,/**/;
I'll also explain PHP's attitude to whitespace. the most obvious reason for adding
If you want to remove whitespace from the beginning and end of the string, you can use the PHP internal function trim (). However, we often want to completely clear the blanks. You need to clear the opening and closing blanks, turn multiple
Xmlreader reads whitespace and comments from XML files by default.
For example, the XML:
Root>
Root-->
File>
File. ATTR>HiddenFile. ATTR>
A.txt
File>
Root>
Xmlreader readingCode:
// Data. xml indicates the preceding
PHP has a built-in Php_strip_whitespace method for reading php files and removing whitespace and comments from the code, but does not support direct read content removal of whitespace and annotations, and the following method supports reading string
In PHP, the TRIM function can only replace the left and right sides of the space, feeling in some cases not very good, if you want to be a string of all white space characters filter out (spaces, full-width spaces, newline, etc.), then we can write
Achieve 1
Copy Code code as follows:
String.prototype.trim = function () {
return this. Replace (/^\s\s*/, '). Replace (/\s\s*$/, ');
}
It does not look very good, using two of regular replacements, the actual speed is
PHP has a built-in Php_strip_whitespace method for reading php files and removing whitespace and comments in the code, but does not support direct read content to remove whitespace and annotations, the following method can support reading string
Remove BlankRemove trailing blanksMake sure that the trailing string is empty, using Rstrip ();Delete whitespace at the beginning of the string, using Lstrip ();Delete whitespace at both ends of the string, using strip ()Code:>>>favorite_language = '
This article brings you to the content of the CSS with what to do with the space processing (example), there is a certain reference value, the need for a friend can refer to, I hope you have some help.
First, the space rules
HTML code spaces are
Goal:1. Using the whitespace of the string module2. Delete left, right, and white space on both sidesThe code is as follows:[email protected] python]# cat rmspace.py#!/usr/bin/env python#Coding:utf8"""use a string to remove left and right whitespace.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.