Hướng dẫn reserved keyword in php - từ khóa dành riêng trong php
Mục lục
Sau đây là danh sách các định danh được xác định trước trong PHP. Không có số nhận dạng nào được liệt kê ở đây nên được sử dụng làm số nhận dạng trong bất kỳ tập lệnh nào của bạn trừ khi được ghi nhận rõ ràng khác. Các danh sách này bao gồm các từ khóa và các biến được xác định trước, không đổi và tên lớp. Những danh sách này không đầy đủ cũng không đầy đủ. Show
Không có người dùng đóng góp ghi chú cho trang này. Sideshowanthony tại googlemail dot com ¶string is series of characters, where a character is the same as a byte. This means that PHP only supports a 256-character set, and hence does not offer native Unicode support. See details of the string type.
18 năm trướcSteve tại MrClay Dot org ¶string literal can be specified in four different ways:
PHP tại Richardneill Dot org ¶9 năm trướcstring is to enclose it in single quotes (the character PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 81). Chalx tại findme dot nếu dot u dot cần ¶
PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 86 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 87 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 88 Headden tại Karelia dot ru ¶13 năm trướcstring is enclosed in double-quotes ("), PHP will interpret the following escape sequences for special characters: Richard Neill ¶
Như trong các chuỗi được trích dẫn duy nhất, việc thoát khỏi bất kỳ nhân vật nào khác cũng sẽ dẫn đến dấu gạch chéo ngược cũng được in.strings, escaping any other character will result in the backslash being printed too. Tính năng quan trọng nhất của các chuỗi được trích dẫn kép là thực tế là các tên biến sẽ được mở rộng. Xem phân tích cú pháp chuỗi để biết chi tiết.strings is the fact that variable names will be expanded. See string parsing for details. HeredocCách thứ ba để phân định chuỗi là cú pháp Heredoc: PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 61. Sau khi vận hành này, một định danh được cung cấp, sau đó là một dòng mới. Bản thân chuỗi theo sau, và sau đó cùng một định danh một lần nữa để đóng trích dẫn.strings is the heredoc syntax: PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 61. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation. Định danh đóng có thể được thụt vào không gian hoặc tab, trong trường hợp đó, thụt lề sẽ bị tước khỏi tất cả các dòng trong chuỗi Doc. Trước PHP 7.3.0, mã định danh đóng phải bắt đầu trong cột đầu tiên của dòng. Ngoài ra, mã định danh đóng phải tuân theo các quy tắc đặt tên giống như bất kỳ nhãn nào khác trong PHP: nó chỉ chứa các ký tự chữ và số và gạch dưới, và phải bắt đầu với ký tự không chữ số hoặc dấu gạch dưới. Ví dụ #1 Ví dụ về Heredoc cơ bản kể từ Php 7.3.0 PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 62 Đầu ra của ví dụ trên trong Php 7.3: Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror:ParseError will be thrown: Ví dụ #2 Định danh đóng không được thụt vào nhiều hơn bất kỳ dòng nào của cơ thể PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 63 Đầu ra của ví dụ trên trong Php 7.3: PHP Parse error: Invalid body indentation level (expecting an indentation level of at least 3) in example.php on line 4 Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror:ParseError will be thrown. These whitespace constraints have been included because mixing tabs and spaces for indentation is harmful to legibility. Ví dụ #2 Định danh đóng không được thụt vào nhiều hơn bất kỳ dòng nào của cơ thể PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 64 PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 65 Tuy nhiên, nếu định danh đóng được thụt vào, các tab cũng có thể được sử dụng, tuy nhiên, các tab và khoảng trống không được kết hợp liên quan đến việc thụt vào định danh đóng và thụt của cơ thể (lên đến định danh đóng). Trong bất kỳ trường hợp nào trong số này, một người sinh viên sẽ bị ném. Những ràng buộc khoảng trắng này đã được đưa vào vì trộn các tab và không gian để thụt vào có hại cho tính dễ đọc. Đầu ra của ví dụ trên trong Php 7.3: PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 8 Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror: Ví dụ #2 Định danh đóng không được thụt vào nhiều hơn bất kỳ dòng nào của cơ thể PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 67 Đầu ra của ví dụ trên trong Php 7.3: array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" } Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror: Ví dụ #2 Định danh đóng không được thụt vào nhiều hơn bất kỳ dòng nào của cơ thểParseError. Tuy nhiên, nếu định danh đóng được thụt vào, các tab cũng có thể được sử dụng, tuy nhiên, các tab và khoảng trống không được kết hợp liên quan đến việc thụt vào định danh đóng và thụt của cơ thể (lên đến định danh đóng). Trong bất kỳ trường hợp nào trong số này, một người sinh viên sẽ bị ném. Những ràng buộc khoảng trắng này đã được đưa vào vì trộn các tab và không gian để thụt vào có hại cho tính dễ đọc. PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 68 Đầu ra của ví dụ trên trong Php 7.3: PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 6 Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror: Nếu mã định danh đóng được thụt vào hơn bất kỳ dòng nào của cơ thể, thì sẽ bị ném parseerror: Ví dụ #2 Định danh đóng không được thụt vào nhiều hơn bất kỳ dòng nào của cơ thể Tuy nhiên, nếu định danh đóng được thụt vào, các tab cũng có thể được sử dụng, tuy nhiên, các tab và khoảng trống không được kết hợp liên quan đến việc thụt vào định danh đóng và thụt của cơ thể (lên đến định danh đóng). Trong bất kỳ trường hợp nào trong số này, một người sinh viên sẽ bị ném. Những ràng buộc khoảng trắng này đã được đưa vào vì trộn các tab và không gian để thụt vào có hại cho tính dễ đọc. Ví dụ #3 thụt khác nhau cho cơ thể (không gian) Định danh đóng My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A1
My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A2 Định danh đóng cho chuỗi cơ thể không bắt buộc phải được theo sau bởi dấu chấm phẩy hoặc dòng mới. Ví dụ: mã sau được cho phép kể từ Php 7.3.0: Ví dụ #tiếp tục biểu thức sau khi nhận dạng đóngstring, without the double quotes. This means that quotes in a heredoc do not need to be escaped, but the escape codes listed above can still be used. Variables are expanded, but the same care must be taken when expressing complex variables inside a heredoc as with strings. Ví dụ #8 ví dụ về chuỗi heredoc trích dẫn My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A3 My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A4 My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A5 Ví dụ trên sẽ xuất ra: My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A Cũng có thể sử dụng cú pháp HEREDOC để truyền dữ liệu cho các đối số chức năng: Ví dụ #9 heredoc trong ví dụ đối số My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A6 Có thể khởi tạo các biến tĩnh và thuộc tính lớp/hằng số bằng cú pháp Heredoc: Ví dụ #10 Sử dụng Heredoc để khởi tạo các giá trị tĩnh My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A7 My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A8 My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A9 Định danh HEREDOC mở có thể tùy chọn được đặt trong các trích dẫn kép: Ví dụ #11 Sử dụng trích dẫn kép trong Heredoc Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.0 NowdocNowDocs là các chuỗi được trích xuất một lần mà Heredocs là các chuỗi được trích dẫn kép. Một nowDoc được chỉ định tương tự như Heredoc, nhưng không có phân tích cú pháp nào được thực hiện bên trong một nowDoc. Cấu trúc là lý tưởng để nhúng mã PHP hoặc các khối văn bản lớn khác mà không cần phải trốn thoát. Nó chia sẻ một số tính năng chung với cấu trúc SGML Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.1, trong đó nó tuyên bố một khối văn bản không dành cho phân tích cú pháp. Một nowDoc được xác định với cùng một trình tự PHP Parse error: syntax error, unexpected identifier "ING", expecting "]" in example.php on line 61 được sử dụng cho Heredocs, nhưng số nhận dạng sau đây được đặt trong các trích dẫn đơn, ví dụ: Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.3. Tất cả các quy tắc cho số nhận dạng Heredoc cũng áp dụng cho các định danh NowDoc, đặc biệt là các quy tắc liên quan đến sự xuất hiện của số nhận dạng đóng. Ví dụ #12 NowDoc Chuỗi trích dẫn ví dụ Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.4 Ví dụ trên sẽ xuất ra: Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'. Ví dụ #13 NowDoc Chuỗi trích dẫn ví dụ với các biến Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.5 My name is "MyName". I am printing some Foo. Now, I am printing some Bar2. This should print a capital 'A': A4 Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.7 Ví dụ trên sẽ xuất ra: My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x41 Ví dụ #14 Ví dụ dữ liệu tĩnh Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.8 Phân tích phân tích biến đổiKhi một chuỗi được chỉ định trong trích dẫn kép hoặc với Heredoc, các biến được phân tích cú pháp trong đó.string is specified in double quotes or with heredoc, variables are parsed within it. Có hai loại cú pháp: một loại đơn giản và một loại phức tạp. Cú pháp đơn giản là phổ biến và thuận tiện nhất. Nó cung cấp một cách để nhúng một biến, giá trị mảng hoặc thuộc tính đối tượng trong một chuỗi với nỗ lực tối thiểu.array value, or an object property in a string with a minimum of effort. Cú pháp phức tạp có thể được nhận ra bởi niềng răng xoăn xung quanh biểu thức. Cú pháp đơn giảnNếu một dấu hiệu đô la ( Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.9) gặp phải, trình phân tích cú pháp sẽ tham lam lấy càng nhiều mã thông báo càng tốt để tạo ra một tên biến hợp lệ. Kèm theo tên biến trong niềng răng xoăn để chỉ định rõ ràng phần cuối của tên. My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x410 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 87 My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x412 Ví dụ trên sẽ xuất ra: He drank some apple juice. He drank some juice made of . He drank some juice made of apples. Tương tự, một chỉ mục mảng hoặc thuộc tính đối tượng có thể được phân tích cú pháp. Với các chỉ số mảng, khung hình vuông đóng ( My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x413) đánh dấu sự kết thúc của chỉ số. Các quy tắc tương tự áp dụng cho các thuộc tính đối tượng như các biến đơn giản.array index or an object property can be parsed. With array indices, the closing square bracket ( My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x413) marks the end of the index. The same rules apply to object properties as to simple variables. Ví dụ #15 Ví dụ về cú pháp đơn giản My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x414 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 87 My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x416 Ví dụ trên sẽ xuất ra: He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two . Kể từ Php 7.1.0, các chỉ số số âm được hỗ trợ. Ví dụ #16 Chỉ số số âm My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x417 Ví dụ trên sẽ xuất ra: The character at index -2 is n. Changing the character at index -3 to o gives strong. Đối với bất cứ điều gì phức tạp hơn, bạn nên sử dụng cú pháp phức tạp. Cú pháp phức tạp (xoăn)Điều này không được gọi là phức tạp vì cú pháp rất phức tạp, nhưng vì nó cho phép sử dụng các biểu thức phức tạp. Bất kỳ biến vô hướng, phần tử mảng hoặc thuộc tính đối tượng có biểu diễn chuỗi có thể được bao gồm thông qua cú pháp này. Biểu thức được viết giống như nó sẽ xuất hiện bên ngoài chuỗi, và sau đó được bọc trong My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418 và My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x419. Vì My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418 không thể thoát ra được, cú pháp này sẽ chỉ được nhận ra khi Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.9 ngay lập tức theo My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418. Sử dụng He drank some apple juice. He drank some juice made of . He drank some juice made of apples.3 để có được một He drank some apple juice. He drank some juice made of . He drank some juice made of apples.4 theo nghĩa đen. Một số ví dụ để làm cho nó rõ ràng:string representation can be included via this syntax. The expression is written the same way as it would appear outside the string, and then wrapped in My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418 and My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x419. Since My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418 can not be escaped, this syntax will only be recognised when the Example of string spanning multiple lines using nowdoc syntax. Backslashes are always treated literally, e.g. \\ and \'.9 immediately follows the My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x418. Use He drank some apple juice. He drank some juice made of . He drank some juice made of apples.3 to get a literal He drank some apple juice. He drank some juice made of . He drank some juice made of apples.4. Some examples to make it clear: He drank some apple juice. He drank some juice made of . He drank some juice made of apples.5 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 87 He drank some apple juice. He drank some juice made of . He drank some juice made of apples.7 Cũng có thể truy cập các thuộc tính lớp bằng cách sử dụng các biến trong các chuỗi bằng cú pháp này. He drank some apple juice. He drank some juice made of . He drank some juice made of apples.8 Ví dụ trên sẽ xuất ra:
He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .1 He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .2 He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .3 Truy cập và sửa đổi chuỗi theo ký tựCác ký tự trong các chuỗi có thể được truy cập và sửa đổi bằng cách chỉ định độ lệch dựa trên 0 của ký tự mong muốn sau chuỗi sử dụng khung mảng vuông, như trong $ str [42]. Hãy nghĩ về một chuỗi như một mảng các ký tự cho mục đích này. Có thể sử dụng các hàm Subr () và Subr_Replace () khi bạn muốn trích xuất hoặc thay thế nhiều hơn 1 ký tự.strings may be accessed and modified by specifying the zero-based offset of the desired character after the string using square array brackets, as in $str[42]. Think of a string as an array of characters for this purpose. The functions substr() and substr_replace() can be used when you want to extract or replace more than 1 character.
Cảnh báo Viết vào một miếng đệm ngoài phạm vi Chuỗi với khoảng trắng. Các loại không số nguyên được chuyển đổi thành số nguyên. Loại bù bất hợp pháp phát ra He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .5. Chỉ có ký tự đầu tiên của chuỗi được gán được sử dụng. Kể từ Php 7.1.0, việc gán một chuỗi trống ném một lỗi nghiêm trọng. Trước đây, nó đã chỉ định một byte null. He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .5. Only the first character of an assigned string is used. As of PHP 7.1.0, assigning an empty string throws a fatal error. Formerly, it assigned a NULL byte. Cảnh báo Viết vào một miếng đệm ngoài phạm vi Chuỗi với khoảng trắng. Các loại không số nguyên được chuyển đổi thành số nguyên. Loại bù bất hợp pháp phát ra He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .5. Chỉ có ký tự đầu tiên của chuỗi được gán được sử dụng. Kể từ Php 7.1.0, việc gán một chuỗi trống ném một lỗi nghiêm trọng. Trước đây, nó đã chỉ định một byte null.
Lưu ý: Kể từ Php 7.1.0, việc áp dụng toán tử chỉ mục trống trên một chuỗi trống ném một lỗi nghiêm trọng. Trước đây, chuỗi trống được chuyển đổi âm thầm thành một mảng. He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .7 Ví dụ #17 Một số ví dụ chuỗi Các độ lệch chuỗi phải là số nguyên hoặc các chuỗi giống như số nguyên, nếu không một cảnh báo sẽ được đưa ra. He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .8 Ví dụ #18 Ví dụ về độ lệch chuỗi bất hợp pháp PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 80
Truy cập các biến của các loại khác (không bao gồm các mảng hoặc đối tượng thực hiện các giao diện thích hợp) bằng cách sử dụng He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two . 9 hoặc He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two . 0 âm thầm trả về The character at index -2 is n. Changing the character at index -3 to o gives strong. 1.Các ký tự trong chuỗi có thể được truy cập bằng cách sử dụng He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .9 hoặc He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .0.string using the The character at index -2 is n. Changing the character at index -3 to o gives strong.5 cast or the strval() function. String conversion is automatically done in the scope of an expression where a string is needed. This happens when using the echo or print functions, or when a variable is compared to a string. The sections on Types and Type Juggling will make the following clearer. See also the settype() function. Truy cập các ký tự trong các chữ viết bằng cách sử dụng cú pháp He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .0 đã được không dùng nữa trong Php 7.4. Điều này đã được gỡ bỏ trong Php 8.0.bool The character at index -2 is n. Changing the character at index -3 to o gives strong.6 value is converted to the string The character at index -2 is n. Changing the character at index -3 to o gives strong.7. bool The character at index -2 is n. Changing the character at index -3 to o gives strong.8 is converted to The character at index -2 is n. Changing the character at index -3 to o gives strong.9 (the empty string). This allows conversion back and forth between bool and string values. Chuyển đổi thành chuỗiint or float is converted to a string representing the number textually (including the exponent part for floats). Floating point numbers can be converted using exponential notation ( PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 800).
Truy cập các biến của các loại khác (không bao gồm các mảng hoặc đối tượng thực hiện các giao diện thích hợp) bằng cách sử dụng PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 802; because of this, echo and print can not by themselves show the contents of an array. To view a single element, use a construction such as PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 803. See below for tips on viewing the entire contents. Các ký tự trong chuỗi có thể được truy cập bằng cách sử dụng He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .9 hoặc He drank some apple juice. He drank some orange juice. He drank some purple juice. John Smith drank some apple juice. John Smith then said hello to Jane Smith. John Smith's wife greeted Robert Paulsen. Robert Paulsen greeted the two .0.objects to string, the magic method __toString must be used. Truy cập các ký tự trong các chữ viết bằng cách sử dụng cú pháp PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 804, where PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 805 is the resource number assigned to the resource by PHP at runtime. While the exact structure of this string should not be relied on and is subject to change, it will always be unique for a given resource within the lifetime of a script being executed (ie a Web request or CLI process) and won't be reused. To get a resource's type, use the get_resource_type() function. Chuyển đổi thành chuỗi is always converted to an empty string. Một giá trị có thể được chuyển đổi thành một chuỗi bằng cách sử dụng hàm The character at index -2 is n. Changing the character at index -3 to o gives strong.5 hoặc hàm strval (). Chuyển đổi chuỗi được tự động thực hiện trong phạm vi của một biểu thức trong đó cần một chuỗi. Điều này xảy ra khi sử dụng các hàm echo hoặc in hoặc khi một biến được so sánh với một chuỗi. Các phần về loại và loại tung hứng sẽ làm cho các phần sau hơn. Xem thêm hàm setType ().array, object, or resource to a string does not provide any useful information about the value beyond its type. See the functions print_r() and var_dump() for more effective means of inspecting the contents of these types. Giá trị bool The character at index -2 is n. Changing the character at index -3 to o gives strong.6 được chuyển đổi thành chuỗi The character at index -2 is n. Changing the character at index -3 to o gives strong.7. Bool The character at index -2 is n. Changing the character at index -3 to o gives strong.8 được chuyển đổi thành The character at index -2 is n. Changing the character at index -3 to o gives strong.9 (chuỗi trống). Điều này cho phép chuyển đổi qua lại giữa các giá trị bool và chuỗi.strings for permanent storage. This method is called serialization, and is performed by the serialize() function. Một int hoặc float được chuyển đổi thành một chuỗi biểu thị số bằng văn bản (bao gồm cả phần số mũ cho phao). Số điểm nổi có thể được chuyển đổi bằng ký hiệu hàm mũ (PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 8 00).Kể từ Php 8.0.0, ký tự điểm thập phân luôn là PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 801. Trước Php 8.0.0, ký tự điểm thập phân được xác định trong ngôn ngữ của tập lệnh (danh mục LC_Numeric). Xem hàm setlocale ().string in PHP is implemented as an array of bytes and an integer indicating the length of the buffer. It has no information about how those bytes translate to characters, leaving that task to the programmer. There are no limitations on the values the string can be composed of; in particular, bytes with value PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 807 (“NUL bytes”) are allowed anywhere in the string (however, a few functions, said in this manual not to be “binary safe”, may hand off the strings to libraries that ignore data after a NUL byte.) Các mảng luôn được chuyển đổi thành chuỗi PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 802; Bởi vì điều này, Echo và Print không thể tự mình hiển thị nội dung của một mảng. Để xem một yếu tố duy nhất, hãy sử dụng một công trình như PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 803. Xem bên dưới để biết các mẹo về xem toàn bộ nội dung. Cho rằng PHP không ra lệnh cho một mã hóa cụ thể cho các chuỗi, người ta có thể tự hỏi làm thế nào các chữ cái được mã hóa. Chẳng hạn, chuỗi PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 808 tương đương với PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 809 (ISO-8859-1), PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 810 (Mẫu UTF-8, C), PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 811 (Mẫu UTF-8, D) hoặc bất kỳ biểu diễn có thể nào khác? Câu trả lời là chuỗi sẽ được mã hóa theo bất kỳ thời trang nào được mã hóa trong tệp tập lệnh. Do đó, nếu tập lệnh được viết trong ISO-8859-1, chuỗi sẽ được mã hóa trong ISO-8859-1, v.v. Tuy nhiên, điều này không áp dụng nếu Zend Multibyte được bật; Trong trường hợp đó, tập lệnh có thể được viết trong một mã hóa tùy ý (được khai báo rõ ràng hoặc được phát hiện) và sau đó được chuyển đổi thành một mã hóa nội bộ nhất định, sau đó là mã hóa sẽ được sử dụng cho các chuỗi chữ. Lưu ý rằng có một số ràng buộc đối với việc mã hóa tập lệnh (hoặc trên mã hóa nội bộ, nên kích hoạt đa tế bào -1. Tuy nhiên, lưu ý rằng các mã hóa phụ thuộc trạng thái trong đó các giá trị byte giống nhau có thể được sử dụng ở trạng thái dịch chuyển ban đầu và không khởi đầu có thể có vấn đề. Tất nhiên, để trở nên hữu ích, các chức năng hoạt động trên văn bản có thể phải đưa ra một số giả định về cách chuỗi được mã hóa. Thật không may, có nhiều biến thể về vấn đề này trong suốt các chức năng của PHP:
Cuối cùng, điều này có nghĩa là viết các chương trình chính xác bằng cách sử dụng Unicode phụ thuộc vào việc tránh cẩn thận các chức năng sẽ không hoạt động và rất có thể sẽ làm hỏng dữ liệu và sử dụng thay vào đó các chức năng hoạt động chính xác, thường là từ các phần mở rộng INTL và MBString. Tuy nhiên, sử dụng các chức năng có thể xử lý mã hóa Unicode chỉ là khởi đầu. Bất kể các chức năng mà ngôn ngữ cung cấp, điều cần thiết là phải biết đặc tả Unicode. Chẳng hạn, một chương trình giả định chỉ có chữ hoa và chữ thường đang đưa ra một giả định sai. John ¶ ¶ 6 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 816 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 817 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 818 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 819 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 820 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 821 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 822 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 823 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 824 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 825 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 826 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 827 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 828 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 829 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 830 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 831 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 832 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 833 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 834 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 835 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 836 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 837 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 838 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 839 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 840 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 841 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 842 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 843 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 844 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 gtisza tại gmail dot com ¶ 10 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 846 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 847 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 848 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 849 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 850 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 rác tại iglou dot eu ¶ ¶ 6 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 852 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 853 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 854 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 855 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 856 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 857 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 858 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 gtisza tại gmail dot com ¶ 10 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 860 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 861 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 rác tại iglou dot eu ¶ ¶ 10 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 863 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 864 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 865 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 rác tại iglou dot eu ¶ ¶ Ray.paseur đôi khi sử dụng gmail ¶ PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 867 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 868 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 869 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 870 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 3 năm trước ¶ 6 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 872 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 873 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 874 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 875 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 876 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 gtisza tại gmail dot com ¶ 10 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 878 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 879 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 rác tại iglou dot eu ¶ ¶ Ray.paseur đôi khi sử dụng gmail ¶ PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 881 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 882 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 necrodust44 tại gmail dot com ¶ ¶ 8 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 884 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 885 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 886 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 887 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 888 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 889 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 890 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 891 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 892 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 atnak tại Chejz dot com ¶ 18 năm trước PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 894 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 895 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 896 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 897 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 898 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 899 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }00 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }01 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 PHP tại Richardneill Dot org ¶ ¶ 9 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }03 Chalx tại findme dot nếu dot u dot cần ¶ ¶ 14 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }04 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }05 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }06 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 Nospam tại Nospam Dot Com ¶ ¶ 6 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }08 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }09 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }10 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }11 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }12 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }13 Headden tại Karelia dot ru ¶ ¶ 13 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }14 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }15 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }16 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }17 Richard Neill ¶ ¶ 15 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }18 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }19 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 jonijnm tại ví dụ dot com ¶ 5 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }21 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }22 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }23 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }24 Greenbluemoonlight tại Gmail Dot Com ¶ ¶ 2 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }25 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }26 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }27 Shd tại Earthling Dot Net ¶ 13 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }28 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }29 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 Richard Neill ¶ ¶ 15 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }31 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }32 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }33 jonijnm tại ví dụ dot com ¶ 5 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }34 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }35 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }36 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }37 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }38 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }39 Greenbluemoonlight tại Gmail Dot Com ¶ ¶ 2 năm trước array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }40 array(2) { [0] => string(11) "a b c" [1] => string(5) "d e f" }41 PHP Parse error: Invalid indentation - tabs and spaces cannot be mixed in example.php line 845 |