Php-what is the role of this function for bitwise XOR or operations?

Source: Internet
Author: User
& Quot; functionfile_mode_info ($ file_path) {* if it does not exist, it cannot be read, written, or changed * if (! File_exists ($ file_path) {returnfalse ;}$ mark0; if (strtoupper (substr (PHP_ OS,) & #39; WIN & #39 ;) {* test file * export test_file=file_path.&%39=cf_test.txt & #39; * If php

Function file_mode_info ($ file_path) {/* if it does not exist, it cannot be read, written, or changed */if (! File_exists ($ file_path) {return false;} $ mark = 0; if (strtoupper (substr (PHP_ OS, 0, 3) = 'win ') {/* test file */$ test_file = $ file_path. '/cf_test.txt';/* if the directory is */if (is_dir ($ file_path) {/* check whether the directory is readable */$ dir = @ opendir ($ file_path ); if ($ dir = false) {return $ mark; // if the directory fails to be opened, the returned directory cannot be modified, written, or read.} if (@ readdir ($ dir )! = False) {$ mark ^ = 1; // Directory readable 001, directory unreadable 000} @ closedir ($ dir ); /* check whether the directory can be written */$ fp = @ fopen ($ test_file, 'WB '); if ($ fp = false) {return $ mark; // if the file creation in the directory fails, the return value cannot be written.} If (@ fwrite ($ fp, 'directory access testing .')! = False) {$ mark ^ = 2; // The directory can be written to read 011, and the directory can be written to non-read 010} @ fclose ($ fp); @ unlink ($ test_file ); /* check whether the directory can be modified */$ fp = @ fopen ($ test_file, 'AB +'); if ($ fp = false) {return $ mark ;} if (@ fwrite ($ fp, "modify test. \ r \ n ")! = False) {$ mark ^ = 4 ;}@ fclose ($ fp);/* check whether rename () is executed in the directory () function permission */if (@ rename ($ test_file, $ test_file )! = False) {$ mark ^ = 8;} @ unlink ($ test_file);}/* if it is a file */elseif (is_file ($ file_path )) {/* open in read mode */$ fp = @ fopen ($ file_path, 'RB'); if ($ fp) {$ mark ^ = 1; // read 001} @ fclose ($ fp);/* try to modify the file */$ fp = @ fopen ($ file_path, 'AB + '); if ($ fp & @ fwrite ($ fp ,'')! = False) {$ mark ^ = 6; // you can modify the value of 111, which cannot be modified ...} @ fclose ($ fp);/* check whether the directory has the permission to execute the rename () function */if (@ rename ($ test_file, $ test_file )! = False) {$ mark ^ = 8 ;}} else {if (@ is_readable ($ file_path) {$ mark ^ = 1 ;} if (@ is_writable ($ file_path) {$ mark ^ = 14 ;}} return $ mark ;}

$ Mark ^ = 1;
$ Mark ^ = 2;
$ Mark ^ = 4;
$ Mark ^ = 8;
What are the functions of these operations? Why?
In addition, all judgments are used! = (Incomplete). What is the role of this operation?
Why don't we use a normal one! =?

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.