Selasa, 29 Oktober 2013

PHP Indonesia - Facebook: Mau tanya nih gan..kasus nya begini

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Manage your social media

Best social media tool for image publishing to Facebook and Twitter. Look amazing and delight your followers. Get 40% off when you sign up today.
From our sponsors
Mau tanya nih gan..kasus nya begini
Oct 29th 2013, 06:46, by Add Inhy

Add Inhy 6:46am Oct 29
Mau tanya nih gan..kasus nya begini

<?php
for ($a=1; $a<=4; $a++)
{
if($a=1){$pilihan="A";}
if($a=2){$pilihan="B";}
if($a=3){$pilihan="C";}
if($a=4){$pilihan="D";}
echo $a;
echo $pilihan;
}
?>

kok tampil nya cuman 4D
yang di ingin kan agar tampilnya itu 1A2B3C4D..? kira kira gimana caranya...?

Sandi Racy 6:49am Oct 29
= bukan operator pembanding

Add Inhy 6:49am Oct 29
jadi gimana solusi nya tu sob..?

Elfasa Zayed 6:52am Oct 29
for ($a=1; $a<=4; $a++)
{
if($a==1)
{$pilihan="A";}
else if($a==2)
{$pilihan="B";}
else if($a==3)
{$pilihan="C";}
else if($a==4)
{$pilihan="D";}
echo $a;
echo $pilihan;
}

Add Inhy 6:54am Oct 29
mantap... haha cuman salah dikit aja... nggak mau ya..

Abu Aisyah Romadhoni 6:55am Oct 29
Coba lain kali dibalik aja nulisnya biar tau errornya. Misal.

if (1 == $a) Agar nanti klo salah tulis seperti if (1 = $a), bakal langsung muncul error.

Add Inhy 6:56am Oct 29
ooh.. mantap.. sob.. (Y)

Ogie Arek Malang 6:59am Oct 29
Mungkin lebih singkat lagi pake array.

$array = array("", "A", "B", "C", "D");

Tinggal manggil : echo $a.$array[$a];

사랑해윤아 7:03am Oct 29
==

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar