PHP is one of the most commonly used programming technologies, so I have studied PHP array deletion. Here I will share it with you and hope it will be useful to you. PHP is a server-side scripting language that is easy to learn and use. With little programming knowledge, you can use PHP to build a truly interactive WEB site.
PHPLIB is the most commonly used base database to provide general transactions. -As mentioned above, the scalability of PHP has entered a period of rapid development. It may be difficult for a non-programmer to extend additional functions for PHP, but it is not difficult for a PHP programmer. -Object-Oriented Programming PHP provides classes and objects. Web-based programming requires Object-Oriented Programming capabilities. PHP supports constructors and extraction classes. -Scalability: traditional web page interactions are achieved through CGI. The CGI program is not ideal for scalability, because it opens an independent process for every running CGI program. Let's take a look at the PHP array deletion code in detail.
PHP array deletion code:
- /**
- * Remove blank elements from the array (including elements with only white spaces)
- *
- * @ Param array $ arr
- * @ Param boolean $ trim
- */
- Copy the Code as follows:
- Function array_remove_empty (& $ arr, $Trim=True)
- {
- Foreach ($ arr as $Key=>$ Value ){
- If (is_array ($ value )){
- Array_remove_empty ($ arr [$ key]);
- } Else {
- $Value=Trim($ Value );
- If ($Value= ''){
- Unset ($ arr [$ key]);
- } Elseif ($ trim ){
- $ Arr [$ key] = $ value;
- }
- }
- }
- }
-
- /**
- * Convert a two-dimensional array to a hashmap
- *
- * If the $ valueField parameter is omitted, each item in the conversion result is an array containing all the data of the item.
- *
- * @ Param array $ arr
- * @ Param string $ keyField
- * @ Param string $ valueField
- *
- * @ Return array
- */
- Copy the Code as follows:
- Function array_to_hashmap (& $ arr, $ keyField, $ValueField=Null)
- {
- $Ret=Array();
- If ($ valueField ){
- Foreach ($ arr as $ row ){
- $ Ret [$ row [$ keyField] = $ row [$ valueField];
- }
- } Else {
- Foreach ($ arr as $ row ){
- $ Ret [$ row [$ keyField] = $ row;
- }
- }
- Return $ ret;
- }