Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the string string type in php

Shulou Source: shulou.com Published: 2022-06-01 13:10:55 09月17日 Update

This article will explain in detail how to use the string string type in php. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Description: it is the data format that php can store. Php provides 8 data types.

Scalar type: int float string boolean

Match type: array object

Special type: null resource

The types provided in the php documentation manual

1. String string type

Description: enclosing any data in quotation marks "" and "'" is a string.

1) single quotation marks

Add single quotation marks in English

2) double quotation marks

Add double quotation marks in English

3) the difference between single quotation marks and double quotes

Double quotation marks can resolve variables, and single quotation marks cannot resolve variables.

$name = 'qingyu';// pure string $name = "qingyu"; echo "user name: {$name}"; / / A double quotation mark can parse the variable echo' user name as: {$name}'; / / the variable output user name is: {$name} / / escape character, in order to make some special characters lose their own meaning in php "user name is:"\ {$name}\ "

4) there are many escape characters in double quotes, and there are only two 'and\ in single quotation marks.

Double quotation mark escape character

5) double quotation mark delimiter writing

Syntax:

$str =

Tags: Quotation marks characters delimiters types strings variables users escapes data articles special codes letters that is more fruit pancakes status symbols pancake fruit Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi MariaDB Redmi Linux