In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the 10 little-known but very useful functions in PHP. I think it is very practical, so I share it with you. I hope you can get something after reading this article.
PHP has a wealth of built-in functions, many of which we have used, but there are still many functions that most of us are not familiar with, but they are very useful. In this article, I list some little-known PHP functions that will brighten your eyes.
Levenshtein ()
Have you ever experienced a time when you need to know how different the two words are? this function is here to help you solve this problem. It can compare the different degrees of two strings.
Usage:
Source: http://php.net/manual/en/function.levenshtein.php
Get_defined_vars ()
This is a very useful function when debugging debug. This function returns a multidimensional array containing all the defined variables.
Usage:
Source: http://php.net/manual/en/function.get-defined-vars.php
Php_check_syntax ()
This function is very useful and can be used to check whether the syntax of PHP is correct. For technical reasons, this function has been removed since PHP 5.05.
Usage:
Source: http://www.php.net/manual/en/function.php-check-syntax.php
Ignore_user_abort ()
This function is used to reject the request of the browser-side user to terminate the execution of the script. Normally, the exit of the client causes the server-side script to stop running.
Usage:
Source: http://www.php.net/manual/en/function.ignore-user-abort.php
Highlight_string ()
The highlight_string () function is very useful when you want to display PHP code on a page. This function will highlight the PHP code you provided with the built-in PHP syntax to highlight the defined color. This function takes two arguments, and the * arguments are a string, indicating that the string needs to be highlighted. If the second parameter is set to TRUE, the function will return the highlighted code as a return value.
Usage
Source: http://php.net/manual/en/function.highlight-string.php
Highlight_file
This is a very useful PHP function that returns the specified PHP file and highlights the contents of the file in a highlighted color according to its semantics. The highlighted code is processed with HTML tags.
Usage:
Source: http://www.php.net/manual/en/function.highlight-file.php
Php_strip_whitespace
This function is also similar to the previous show_source () function, but it removes comments and spaces from the file.
Usage:
Source: http://www.php.net/manual/en/function.php-strip-whitespace.php
Get_browser
This function reads the browscap.ini file and returns browser compatibility information.
Usage:
Source: http://www.php.net/manual/en/function.get-browser.php
Memory_get_usage (), memory_get_peak_usage (), getrusage ()
These functions are used to get memory and CPU usage, the memory_get_usage () function returns memory usage, the memory_get_peak_usage () function returns the peak memory usage, and getrusage () returns CUP usage. These functions will provide you with some useful information when debugging PHP code performance. Note, however, that it is not valid on Window in these functions.
Usage:
Gzcompress (), gzuncompress ()
These two functions are used to compress and decompress string data. Their compression ratio can reach about 50%. The other functions gzencode () and gzdecode () achieve similar results, but use different compression algorithms.
Usage:
Do you also think of other useful functions? Please share it in the comments!
These are the 10 little-known but very useful functions in PHP. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.