Home  >  Article  >  Backend Development  >  what are escape characters in php

what are escape characters in php

L
LOriginal
2020-06-01 11:14:464678browse

what are escape characters in php

php basics - escape characters

1. PHP is a weakly typed language. There is no need to define

when defining variables.

2. Scalar type: integer, floating point type, string type, Boolean type

Composite type: array, object

Other types: resource type (resource such as database connection, open File handles and resources must be released when no longer needed)

3. When defining a string, single quotes will not parse the newline character\n carriage return character\r tab character\t and php variables , but the escaped \\ and \' can be parsed (the parsing is not to display the web page on the web page but only has an effect on the html tag)

This php code is wrong because \' will be parsed into ' in the character , $str='abc\'; In this way, the variable definition is incomplete. It needs to be like this: $str='abc\\'; or $str='abc\''; It depends on which character actually needs to be escaped.

In double quotes, {} can be used to avoid variable confusion.

4. Escape characters:

\ is an escape character: an escape character is a special character constant. The escape character starts with a backslash "\" and is followed by one or more characters. Escape characters have specific meanings that are different from the original meaning of the characters, so they are called "escape" characters.

\n Carriage return and line feed\t Jump horizontally to the next tab position \v Vertical tab\b Backspace\r Carriage return, \f Paper feed and page feed, \\ Backslash character\ , \' single quotation mark '

what are escape characters in php

## Recommended tutorial: "

PHP Tutorial"

The above is the detailed content of what are escape characters in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn