Your Ad Here

Home » PHP Code »

1

Hi friends,

In our php application some times we want to highlight the source code to user friendly , so the following function helped you to highlight the source code.

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
if (!empty($_POST['text'])){
echo '<div style="border: solid 1px red; width:300px;height: 150px; padding: 20px; margin: 20px">';
highlight_string(stripslashes($_POST['text']));
echo '</div>';
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<textarea name="text" style="width: 300px; height: 150px;padding: 20px; margin: 20px"><?php echo stripslashes($_POST['text']);
?></textarea>
<br />
<input type="submit" />
</form>

The output of this code will be -

Code highlight in php application

Code highlight in php application


You may like these posts

    How to calculate statistics in daily, weekly , monthly and yearly using phpDate Format in the PHP Code?How to convert feeds to html using javascript and phpHow to get loaded modules in the server using php code

 

1 Comment

  1. Rakesh says:

    Hi Ani,

    Nice post..if you post in ror also then it is better to me.

    Thanks

Leave a Reply