Page 1 of 1
fuctions difference in php
Posted: Mon May 17, 2010 5:12 am
by majidali
can ne one explain me the diff between
1)define() and constant()
2)echo and print()
3)exit() and die()
thanx in advance
Re: fuctions difference in php
Posted: Mon May 17, 2010 5:51 am
by hypedupdawg
1) The define() and constant() functions work together like so;
Code: Select all
<?php
define("GREETING","Hello you! How are you today?");
echo constant("GREETING");
?>
2) There is almost no difference between print and echo - although echo is marginally faster.
3) exit() is just an alias of the die() fuction - they are exactly the same.
Re: fuctions difference in php
Posted: Mon May 17, 2010 1:51 pm
by flying_circus
hypedupdawg wrote:2) There is almost no difference between print and echo - although echo is marginally faster.
print accepts only 1 parameter.
echo will accept n number of parameters and concatenate them into 1 string.