PHP notes [2]

Source: Internet
Author: User
Tags fread sorts

Strlen () function to get the length of character channeling

Read files: fgets (), FGETSS () and Fgetcsv ()

Read the entire file: ReadFile (), Fpassthru (), and file ()


Read one character: Fgetc ()

The only disadvantage of using the fgetc () function is that it returns the file Terminator eof, and Fgets () does not


Length of reading set: Fread ()

Fread (resource fp,int length);

To see if a file exists: File_exists ()

Determine file Size: FileSize ()

Delete file: Unlink ()

Locate in File: Rewind (), fseek (), and Ftell ()

----------------------------

Chapter III


The range () function automatically creates a function

The following line of code will automatically create a 1~10 array of numbers

$numbers = range (1,10);

The range () function has an optional third parameter that allows you to set the stride between values.


Reset () sets the current element back to the array
Starting at


--------------
3.4

Sort () sorts an array
Sort ($prices) sorts the numbers or letters within a $prices

If the associated array such as $prices = Array (
' Tires ' =>100, ' oil ' =>10, ' Spark plugs ' =>4 ';
Asort ($prices);

The function Asort () is sorted according to the element values in the array, where the element value is the price, and Ksort () is sorted alphabetically by the keyword of the array

Reverse sort: rsort (), Arsort () and Krsort ()

Shuffle () random order

Array_reverse () gives a reverse sort of the original array

PHP notes [2]

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.