1.

Find the error in each of the following PHP scripts:(a) >?php/* print a line of output /echo ‘hello’?>(b) >?phpecho'<p align=”right”>Copyright Me, 2008</p>';?>(b)  <?phpecho'Line 1;?>

Answer»

(a) There is an error

Un terminated comment line The correct code is as follows <!--?php /‘print a line of output*/ echo’hello’-->

<?php

/‘print a line of output*/

echo’hello’

?>

(b) no error. 

(c) String must be enclosed in single or double quotes. The correct code is as follows.

<?php

echo’Line 1‘;

?>



Discussion

No Comment Found