The Difference Between Echo And Print In PHP
Computing : Learning PHP One common question people have is why there are two functions that seem to do the same thing in PHP. In some books you read, all the programs will use print to print data, whilst in other books you will see echo used. Do some use echo as it has one less character and others print just because it is more obvious what it does from the off? Well in practice there is a difference between the two but very few programs use it. That is that one returns a 1 on success and a 0 on failure whilst the other doesn't. Echo doesn't return anything whilst print returns 1 on success. Thus if you ever conceive of a place where this is needed then use print to get a return value and see if the print statement worked.
Questions about learn PHP:
|
|