1StopCoders

Code Examples and Industry News

Hello World in PHP

PHP - 0 Comments - Created by Casey Martin: 2014-05-10 20:17:00

To output PHP code, you start with . The keyword echo will output text or html. The contents of the echo must be wrapped in quotes and end with a semicolon.

echo "

Hello World

";


Display Query Results Using PHP Function Var_Dump

PHP - 1922 Comments - Created by Casey Martin: 2014-05-10 20:13:00

To display MySQL query results in PHP, you can use var_dump(). Here's an example:

$sql = mysql_query("SELECT * FROM your_table WHERE key = 'value'");
$assoc = mysql_fetch_assoc($sql);

// Dump variable containing the result of the MySQL query
var_dump($assoc);


Using PHP Function Strip_Tags to Remove HTML

PHP - 0 Comments - Created by Casey Martin: 2014-05-10 17:12:00

Use strip_tags() to remove html from a string.

$htmlvariable = "Is this bold?";
echo strip_tags($htmlvariable);