PHP Echo text Color

How about writing out some escape sequences? echo “\033[01;31m Request has been sent. Please wait for my reply! \033[0m”; Won’t work through browser though, only from console ;))

php echo vs open&close tag

Benefits of first one Easier to read ??? Benefits of second one WYSIWYG is possible HTML Code Completion/Tag-Matching possible with some IDEs No escaping headaches Easier for larger chunks of HTML If I have a lot of HTML in a given PHP routine (like an MVC view) then I definitely use the 2nd method. But … Read more

How do you strip quotes out of an ECHO’ed string in a Windows batch file?

The call command has this functionality built in. To quote the help for call: Substitution of batch parameters (%n) has been enhanced. You can now use the following optional syntax: %~1 – expands %1 removing any surrounding quotes (“) Here is a primitive example: @echo off setlocal set mystring=”this is some quoted text” echo mystring=%mystring% … Read more

How to use css style in php

I guess you have your css code in a database & you want to render a php file as a CSS. If that is the case… In your html page: <html> <head> <!- head elements (Meta, title, etc) –> <!– Link your php/css file –> <link rel=”stylesheet” href=”https://stackoverflow.com/questions/13201451/style.php” media=”screen”> <head> Then, within style.php file: <?php … Read more

How to clear previously echoed items in PHP

<?php ob_start(); echo ‘a’; print ‘b’; // some statement that removes all printed/echoed items ob_end_clean(); echo ‘c’; // the final output is equal to ‘c’, not ‘abc’ ?> Output buffering functions The output buffering functions are also useful in hackery to coerce functions that only print to return strings, ie. <?php ob_start(); var_dump($myVar); $data = … Read more