i want to show my php codes no the result of the codes.
is there any way or function to does it?
What do you mean by showing your php codes, they normally don't show, they do something that might produce something that shows as HTML or an image. Could you clear up what it is that you would like to show or display?
Hi! This will show you the code in a file:
$filename = 'myFile.php'; $string = file_get_contents($filename); $string = str_replace('<?php', '', $string); $string = str_replace('?>', '', $string); echo '<pre>'; echo $string; echo '<pre>';
Do you want to show the code of a selected file (user selects from a list), or do you want that people who visit this file (visit the url) see the code.
For the first way use the highlight_file() function. (see php.net for more info)
For the second way use a free non-php supporting host :p
If you just want to show a snippet of code on a htm page, you can use the non-php host, or just wrap it up like this.
<pre> <?php $this->code = "This is some php code"; ?> </pre>
[man]highlight_string/man.