Trang chủTrang chủ Liên hệLiên hệ
PHP BASIC

» Events  » References  » Tutorials  » Hướng dẫn  RSS Feed2.0 Đăng ký | Đăng nhập

Dịch PHP Manual (đã dịch 86 /1248)
Thêm bài viết mới
#Thêm ý kiến
Emotion|Show / Hide

đoạn này sẽ chuyển 1 array 2 chiều thành 1 chuỗi dạng key1=>value1,key2=>value2,..
<?php
$arr
= array('a'=>1,'b'=>5);
function
__map($a,$b){
    return
"$a=>$b";
}
function
__toString($array){
    
$a = array_keys($array);
    
$b = array_values($array);
    
$t = array_map('__map',$a,$b);
    return
implode(',',$t);
}

$t = __toString($arr);
print
$t; // a=>1,b=>5
?>

Tác giả:TG
Webmaster
http://phpbasic.com

Show / Hide
#Thêm ý kiến

Add phpBasic to your browser's search box
Digg.com delicious Furl Google Bookmark Reddit Slashdot Yahoo My Web

Tableless template Framework PHP functions
 


XHTML Standard
Xây dựng & phát triển bởi tất cả các thành viên.
Powered by http://phpbasic.com