How to convert variable name to a string?

April 6, 2013 at 12:37 pm Leave a comment

Jadi ceritanya mau mengirimkan parameter, tapi butuh variabel supaya namanya diubah menjadi string, misalnya

$var['a']='ayam';
$var['b']='kecap';

mau diubah menjadi:  vara=ayam&varb=kecap

gimana caranya? baca script ini!

$var['a']='ayam';
$var['b']='kecap';

print "<pre />";
$param=array();
foreach($var $key => $value){
$param[]=$key."=".$value;
}

$param= implode("&", $param);
print ($param);

Selamat mencoba …😀

Entry filed under: PHP. Tags: .

Bahasa Kita: membunuh … blalalala – sadis! Kesal: Cara menggunakan Google!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Because I Learn CI and Jquery

http://api.jquery.com

http://www.grocerycrud.com

http://Zedwood.com

Twitter Updates

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

My FB page


%d bloggers like this: