/tags/php/snips

Related Books

X

Snips

» most recent recently popular most popular
score: 0  posted by: mkaz in: php  tags: object, array

A quick easy way to convert a PHP object to an array by using the (array) cast.

1 comment
score: 1  posted by: mkaz in: php  tags: timer, performance, benchmarking

Use this class to measure how long it takes for a script or function to execute

0 comments
score: 1  posted by: ccheever in: php  tags: xml, xmlentities

Many people don't realize that the escaping for XML and HTML is subtly different. In PHP, people often use htmlentities when they want to escape XML, but that doesn't handle some of the substitutions correctly. Here is some code found in some comments...

0 comments
score: 0  posted by: mkaz in: regex, php 

A couple of quick examples of how to do a regular expression match in PHP.

0 comments
score: 1  posted by: mkaz in: php  tags: string, validate, email, e-mail

Check a passed string is a valid e-mail format, does not truly check if it is a valid e-mail, just that it looks right.

0 comments
score: 1  posted by: mkaz in: php  tags: string, escape

Similar to htmlspecialchars but escapes a string for use in javascript, for example being passed as a variable.

0 comments
score: 1  posted by: mkaz in: php  tags: httpstatuscode

How to send the appropriate HTTP status code programattically using PHP. There are a few scenarios you may want to do this. I'm using this for a 301 redirect code, for an RSS feed to let the bot know that the RSS feed is in a new location and to fetch fro...

0 comments