The array_filter function can be used to filter out elements with null key values. The array key name remains unchanged. If you want to filter the key names from 0 again, you can use the array_values function. The array_filter function can be used to filter out elements with null key values. The array key name remains unchanged. If you want to filter the key names from 0 again, you can use the array_values function.
Script ec (2); script
| The Code is as follows: |
|
|
$ Imgurl_str = "| http://www.111cn.net | http://www.111cn.net | http://www.111cn.net ";
$ Imgurl_arr = explode ("|", $ imgurl_str );
$ Imgurl_arr = array_filter ($ imgurl_arr );
Print_r ($ imgurl_arr );
$ Imgurl_arr = array_values ($ imgurl_arr );
Print_r ($ imgurl_arr );
/*
Array
(
Http://www.111cn.net
Http://www.111cn.net
[4] => http://www.111cn.net
)
Array
(
Http://www.111cn.net
Http://www.111cn.net
Http://www.111cn.net
)
*/
?> |