Outputing Or Displaying PHP CODE To The Browser Unformated. - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Outputing Or Displaying PHP CODE To The Browser Unformated. (804 Views)
| Outputing Or Displaying PHP CODE To The Browser Unformated. by KOLONIZA(op): 11:28am On May 28, 2013 |
Gudday to you my fellow programmers, Please i really need a help from you, av got dis project m working on nd m now grounded by this lil issue which is that. I want to output some php code to the browser like <?php $problem = ' cant output this to the browser'; echo $problem; /* i want all the code to be outputed as typed */ ?> please can anyone help me? |
| Re: Outputing Or Displaying PHP CODE To The Browser Unformated. by noobsaibot2(m): 11:37am On May 28, 2013 |
WRITE IT UNDER THE <CODE></CODE> TAG OF YOUR HTML ![]() |
| Re: Outputing Or Displaying PHP CODE To The Browser Unformated. by KOLONIZA(op): 2:23pm On May 28, 2013 |
To illuminate dis post very well, am pulling out d codes from a mysql db, so my end page is a php formate page, so i can really wrap much html tages |
| Re: Outputing Or Displaying PHP CODE To The Browser Unformated. by adewasco2k(m): 9:09pm On May 28, 2013 |
i am not sure about this as i am not a pro in php yet but you can try to use escape like this. <?php error_reporting(0); echo "<?php \$problem = ' cant output this to the browser';<br/> echo \$problem; /* i want all the code to be outputed as typed */ ?>"; ?> |
| Re: Outputing Or Displaying PHP CODE To The Browser Unformated. by adewasco2k(m): 9:10pm On May 28, 2013 |
You should use htmlspecialchars. It replaces characters as below: '&' (ampersand) becomes & '"' (double quote) becomes " "'" (single quote) becomes ' '<' (less than) becomes < '>' (greater than) becomes > |
| Re: Outputing Or Displaying PHP CODE To The Browser Unformated. by KOLONIZA(op): 10:33am On May 30, 2013 |
Thanks to you all my man, i was Able to find out what it was, and that is htmlentities(); i will pass line of codes to the fucnction like. <?php $mycode ='the special php lines'; echo htmlentities($mycode), /*this output the code as written.*/ ?> |
Help On Php Code For A Dice Game • Vb.net Code To Display Image In Picturebox From Sql Server • Help me convert this Vb6.0 code To Vb.net • 2 • 3 • 4
. • Help On Php Form • Bragnvent App Lets You Boast, Complain And Share Photos Anonymously Online