PHP Learning Small Notes

Source: Internet
Author: User

PHP 's four marker styles

1.XML Style

<?php

echo "XML style ";

?>

2. Script Style

<scriptlanguage= "PHP" >

echo ' scripting style ';

</script>

3. Short style

<?echo ' short style ';? >

4.ASP Style

<%

Echo ' ASP style ';

%>

PHP three style of annotation

1. Single-line comment //

2.Multiline Comment /*...*/ ( nested operation not allowed )

3.Shell style Comment #

single and double quotation marks differences in PHP

Single quotes: What you see is what you get

double quotes: content can be interpreted and replaced

<?php

$test = "PHP";

$str = "I like $test";

$str 1= ' I like $test ';

Echo $str;

echo $str 1;

?>

The result is

ILike PHP

ILike $test

PHP string Interception Considerations

When the substr () function intercepts a Chinese string, if an odd number occurs in the truncated string, it may cause the intercepted characters to be garbled because a Chinese character consists of two bytes.

PHP Comparison String

1. String comparisons by Byte

strcmp () case-sensitive

STRCASECMP () is case insensitive

equals is returned 0

2, natural sorting method for string comparison

STRNATCMP () returns equal to 0; Case Sensitive

STRNATCASECMP () is case insensitive

3, specify the location from the source string to start the comparison

STRNCMP () case-sensitive


This article from "11911385" blog, declined reprint!

PHP Learning Small Notes

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.