fuctions difference in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
majidali
Forum Newbie
Posts: 17
Joined: Thu Mar 11, 2010 3:33 am

fuctions difference in php

Post 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
User avatar
hypedupdawg
Forum Commoner
Posts: 74
Joined: Sat Apr 10, 2010 5:21 am

Re: fuctions difference in php

Post 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.
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: fuctions difference in php

Post 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.
Post Reply