perintah echo pada php

— perintah echo pada php —-

— listing standar html.
<img src=”otong.jpg” width=”100px” />

— listing standar php.
<?php
$a=2;        //int tidak ada kutip
$b=”saru”; // string kutip 2
$b=’saru’; //tidak disarankan keras !!!!!!!!!!!!!!!!!!!!!!!!!!! database,
$gambar=otong.jpg;

echo $a;// out put 2
echo “$a”;// out put 2 tidak disarankan keras !!!!!!!!!!!!!!!!!!!!!!!!!!!!!…….karena variabel
echo ‘$a’; output -> $a

echo “hasil adalah $a” ; // output -> hasil adalah 2
echo ‘hasil adalah $a’ ; // output -> hasil adalah $a
echo “hasil adalah”. $a.”<br/>” ; // output -> hasil adalah 2

echo ‘<img src=”$gambar” width=”100px” />’; sangat keras tidak disarankan !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo “<img src='”.$gambar.”‘ width=’100px’ />”;
?>
// wilayah html
<img src=”<?php echo $gambar;?>” width=”100px” />

<?php

?>

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