Php Xiao Ji (a)

Source: Internet
Author: User

1.GETCWD () and =__file__ differences

<?php
$a = GETCWD ();

The value of variable A is D:\PHP\ZEND6.1\CH6
$b =__file__;

The value of variable B is D:\php\zend6.1\ch6\test.php

?>

This shows that GETCWD () returns the absolute path of the file, but not the name of the file itself. __FILE__ is the absolute path where the file is located, but with the name of the file itself.

<?php
Include_once '. /test.php ';
echo $a;//The value in variable A is D:\PHP\ZEND6.1\CH6\ADMINCP
Echo ' <pre> ';
echo $b;//The value in variable B is D:\php\zend6.1\ch6\test.php
?>

This shows that the test.php file is included in another file. The path variable A of test.php obtained with GETCWD () in the test.php file changes after it has been contained. The directory structure is added to the ffff.php directory ADMINCP, so • __file__ better when locating files

2.version_compare

Compare PHP Versions

3.phpversion (' Extended name ')

Returns the current PHP version, with parameters indicating the current extended version

Php Xiao Ji (a)

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.