I’m optimizing my Meta Box plugin and I need a way to measure the project’s statistics such as complexity and maintainability. After searching on Google, I found PHPMetrics, a wonderful project that can help me understand lots of key metrics for a PHP project. The result is displayed in a HTML report with some graphs and table of metrics which are very easy to understand. I tried using it with the Meta Box plugin and here is the result:
There’s a question about regular expression on WPQuestions yesterday that received some interesting solutions. The question is replace all semicolons between
]]. I myself found a solution uses “e” modifier which I think interesting.
PHP has 2 types of comments: comment block (for long comments in many continuous lines) and short comment (for one line). When test code, if we don’t want to a block of code execute, we can disable it by turning them into comment blocks using
/* ... */, and when we want to execute it, just remove
*/ characters at the beginning and the end of code. This action is often repeated, and in this article, I want to share a small tip to make this process faster and easier.
There are various url shortener services on the Internet, you can use free services such as bit.ly, tinyURL or create your own url shortener using some open sources. In this article, I’ll show you how to create a simple page that shows short urls created by multiple url shortener services. I’ll use HTML5, CSS3 for styling as well as jQuery for working with Ajax.
URL Shortener makes a short version of a long given URL. There are many URL shorteners out there like bit.ly, tinyurl or is.gd. Of course we can use their API to create short urls, but it’s not interesting for developers, who want to look into the very deep of the mechanism.
Short url often has structure:
hash is a string (unique) for a long url. Hash contains only digits and letters. In some cases letters are case sensitive.
Short url services like bit.ly, tinyurl are very helpful to make a short version of our long urls. In some cases, we want to expand short url to make sure it has been shortened correctly, or to check if someone gives us a harmful link. Expanding short url to long url using PHP is easy as we’ll see in this article.