PEAR和PECL的區別及PCRE和POSIX的區別
/**************by garcon1986*******************/
PEAR (PHP Extension and Application Repository)PHP擴充套件與應用程式庫。
PEAR是“一個可重用PHP元件的框架和釋出系統”。PEAR可以下載、安裝、升級及刪除PHP指令碼。
使用PEAR包的時候,不必為了指令碼的位置或者怎麼找到它們而擔心,擴充套件命令列介面(CLI)也很容易使用。
PEAR是一個由社群推動的PHP專案,官方釋出的PHP中就包含了PEAR。
PECL
(PHP
擴充套件庫)的全稱是 The PHP Extension Community Library ,是一個開放的並通過PEAR打包格式來打包安裝的PHP 擴充套件庫倉庫。通過PEAR 的Package Manager可以對 PECL 模組進行下載和安裝。
PEAR和PECL的區別:
Pear:是PHP的擴充套件程式碼包,所有的擴充套件均以PHP程式碼的形式出現,功能強大,安裝簡單,甚至可以改改就用。使用的時候,要在程式碼中進行Include才能夠使用。
Pecl:是PHP的標準擴充套件,可以補充實際開發中所需的功能,所有的擴充套件都需要安裝,在Windows下面以Dll的形式出現,在linux下面,需要單獨進行編譯,它的表現形式為根據PHP官方的標準用C語言寫成,儘管原始碼開放但是一般人無法隨意更改原始碼。
最直接的表述:Pear是PHP的上層擴充套件,Pecl是PHP的底層擴充套件。
這兩種方法其實都是為特定的應用提供現成的函式或者類,本質上來說都是一樣的。
正則表示式 :
PCRE :PERL相容正則表示式函式(perl compatible regular expression)
函式:
- preg_filter — Perform a regular expression search and replace
- preg_grep — Return array entries that match the pattern
- preg_last_error — Returns the error code of the last PCRE regex execution
- preg_match_all — Perform a global regular expression match
- preg_match — Perform a regular expression match
- preg_quote — Quote regular expression characters
- preg_replace_callback — Perform a regular expression search and replace using a callback
- preg_replace — Perform a regular expression search and replace
- preg_split — Split string by a regular expression
POSIX :
函式:
- posix_access — Determine accessibility of a file
- posix_ctermid — Get path name of controlling terminal
- posix_errno — Alias of posix_get_last_error
- posix_get_last_error — Retrieve the error number set by the last posix function that failed
- posix_getcwd — Pathname of current directory
- posix_getegid — Return the effective group ID of the current process
- posix_geteuid — Return the effective user ID of the current process
- posix_getgid — Return the real group ID of the current process
- posix_getgrgid — Return info about a group by group id
- posix_getgrnam — Return info about a group by name
- posix_getgroups — Return the group set of the current process
- posix_getpgid — Get process group id for job control
- posix_getpgrp — Return the current process group identifier
- posix_getpid — Return the current process identifier
- posix_getppid — Return the parent process identifier
- posix_getpwnam — Return info about a user by username
- posix_getpwuid — Return info about a user by user id
- posix_getrlimit — Return info about system resource limits
- posix_getsid — Get the current sid of the process
- posix_getuid — Return the real user ID of the current process
- posix_initgroups — Calculate the group access list
- posix_isatty — Determine if a file descriptor is an interactive terminal
- posix_kill — Send a signal to a process
- posix_mkfifo — Create a fifo special file (a named pipe)
- posix_mknod — Create a special or ordinary file (POSIX.1)
- posix_setegid — Set the effective GID of the current process
- posix_seteuid — Set the effective UID of the current process
- posix_setgid — Set the GID of the current process
- posix_setpgid — Set process group id for job control
- posix_setsid — Make the current process a session leader
- posix_setuid — Set the UID of the current process
- posix_strerror — Retrieve the system error message associated with the given errno
- posix_ttyname — Determine terminal device name
PCRE比POSIX更強大。