Posted by R. Rajesh Jeba Anbiah on 09/28/67 11:49
pulkit.gaur@gmail.com wrote:
> Hi all ,
>
> I have a PHP class.
> In the constructor method i use the following code :
>
> constructor func .......
> {
> echo "<script type=\"text/javascript\">";
> echo "alert('hi');
> echo "</script>";
> }
FWIW, many people don't know that they can embed HTML inside PHP;
if embedded, it's easier to maintain/debug and faster to execute.
Example:
function foo()
{
?>
<script>
alert("foo");
</script>
<?php
}
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
[Back to original message]
|