What are the little-known php skills?

Source: Internet
Author: User
What are the little-known php skills? What are the little-known php skills?

The problem has been disabled. cause: the problem cannot obtain the exact result.

Reply content:

What are the little-known php skills?

According to my recent interview, 90% people do not know that the latest stable PHP version is 5.6. (The job is for advanced PHP development)
Okay, let's say:
ini_getOnly PHP built-in and extended configuration can be obtained. Custom configuration added by yourself cannot be obtained through ini_get. Whileget_cfg_varThe function can read the custom configuration key values in php. ini.

Article 1: upgrade PHP 5.4-5.6
Article 2: anyway

PS: PHP5.2/3 is still used.

Shake your head.

Php6 is actually useless.

php -aYou can enter the interactive environment

PHP provides two predefined variables for receiving command line parameters in PHP scripts:
Http://php.net/manual/zh/reserved.variables.php
$ Number of parameters passed to the script by argc
$ Argv [] parameter array passed to the script

Getopt can be used to obtain the command line parameter options and return an Associated array of parameter names and values.
Http://php.net/manual/zh/function.getopt.php
Separate characters (not allowed)
Followed by a colon (this option requires a value)
Followed by two colons (optional)

#! /Png/php/5.4.39cnt/bin/php
  Chmod + x cli. php./cli. php-a1024-b2048 or php cli. php-a1024-b2048

Output:

Array(    [a] => 1024    [b] => 2048)

Comment out$argv = getopt("a:b:")Output:

Array(    [0] => ./cli.php    [1] => -a1024    [2] => -b2048)

PHP can also be used as an automated system management script like Perl:
$ Argv [] parameter array stored in the PHP script:
Http://php.net/manual/zh/reserved.variables.php
PHP provides many file system operating functions, such:
Http://php.net/manual/zh/ref.filesystem.php

file_existsfile_get_contentsfile_put_contentsis_readableis_writableis_executableis_dirmkdirrmdirunlinkchmod

PHP can also call system commands as easily as Shell by using the anti-apostrophes 'or shell_exec, you can also easily use popen/proc_open to open a non-blocking pipeline to execute commands and obtain the returned data. the key is that PHP also has a built-in super invincible and easy-to-use associated array (hash table) and a series of array operation functions and string processing functions. this is cool, not to mention.

Common operations are Excal and compressed packages in PHP.

Haha, in fact, all the manuals are written.

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.