This is really a time to squeeze.-php Foundation (iii), Squeeze time-php basic _php Tutorial

Source: Internet
Author: User

This is really a time to squeeze.-php Foundation (iii), Squeeze Time-php Foundation


Hi

Just saw the Chinatown detective, 5 stars praise Ah Pro. Because it is a long time, it is not good to refuse (although it is with the male. ), but it's time to write. Tomorrow morning the teacher's project knot, although and I do not have a relationship, but do not mess on the good!!

1. PHP

First, PHP Foundation (iii)
1.3.2 Int

Integral type.

Several points: the system Problem (2,8,16);

Overflow--automatically converted to float after overflow;

Divisible

Float to int--downward rounding;

Example gives the

$shi = 123;
$bin =0b100001;
$ba = 0123;
$shiliu =0x1234555;

function Show ($a) {
echo "Truth is:";
Var_dump ($a);
echo "
";
}

Show ($shiliu);
Show ($BA);
Show ($bin);

$qiguaideba = 01237823; Octal "Overflow", will truncate, output only 01237

Show ($qiguaideba);

function Zhengchu ($a, $b) {
$c = $a/$b;
if (Is_float ($c)) {
Var_dump (Round ($c)); Using round to control output results
}else{
Var_dump ($c);
}
}

Zhengchu ($shiliu, $BA);

1.3.3 Float

Different versions of PHP, the accuracy of floating-point type seems to be changed, and the pit father, because of the PHP internal mechanism of the problem, may appear:

Var_dump (Floor ((0.1+0.7) *10));

The return is often 7 instead of the expected 8 ....

Use high-precision words, with the GMP function , please go to understand ...

Then if you really want to compare, set a minimum value to compare:

$bijiao 1=0.232342342;
$bijiao 2=0.232342323;
$esp = 0.000001;
if (ABS ($bijiao 1-$bijiao 2) <= $esp) {
echo "True". "
";
}else{
echo "F**k". "
";
}

1.3.4 string

A single double quotation mark is the ~

And the only thing to say is Heredoc:

$str = <<< EOF
Alsidjflja
Akjsdhflkj
Dfjlkj.
EOF;

Echo $str;

This is basically the way it is, but notice that the last line, the EOF, must be closely tied to the semicolon, and that the semicolon must be followed by a newline, and that EOF cannot precede anything that includes spaces;

Then Heredoc can also be used to pass parameters, initialize static values and so on;

Of course, Heredoc can also invoke parameters AH attributes--to the EOF as a large double quotation mark.

Other strings related, such as what I often use. Do connectors or something, relatively basic, but good, to see the video is very clear.

Nowdoc is also a relatively new way, not too familiar, and then seems to be equivalent to single quotes.

1.4 Variables

Variables are useful, variables are flexible, variables are difficult to use-generally it is gradually thought.

First, PHP does not emphasize the assignment of the initial value, do not need to declare, but recommend or assign the initial value, develop good habits ; the value of the variable is the default value of its type;

Second, the reference assignment to know, $b =& $a; The variable name can only be manipulated;

Thirdly, the assignment is updated one time:

$shit = "ASDF";
$s = 123;

Echo $shit;

$shit = $s;
Echo $shit;

2, the GD library realizes the picture watermark and the thumbnail image

First, Introduction

Use your own GD library in PHP to create a watermark for your images.

Easy handling for large volumes of images.

Learn the basic method and then encapsulate it as a tool class.

This weekend, in addition to Star Wars, to mend the mend, know wrong ....

http://www.bkjia.com/PHPjc/1088266.html www.bkjia.com true http://www.bkjia.com/PHPjc/1088266.html techarticle This is really a time to squeeze.-php Foundation (three), Squeeze time-php Foundation hi just saw the Chinatown detective, 5 stars praise Ah Pro. Because it is a long time, it is not good to refuse (although it is with the male ...

  • Related Article

    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.