For example, I want date in this format
Use format string "Y-m-d"
Here is a sample html file contains only "p" and "div" tag:
And we want to insert content into the html, we don't want undermine the html structure, we wish to delimit it in terms of html element, not just characters. We also want to know the positions we want to insert the content. We can use PREG_OFFSET_CAPTURE:
One day you found that the page takes almost one minute to load. And it not happened before. You don't know which part of your program get a performance bottleneck. But some complex sql queries looks suspicious.
You want to know how much time elapsed for each of these queries.
Both echo and print_r are widely used in day to day PHP programming, but raw print_r is very unfriendly to HTML display which is the de facto output interface in web developing environment.
Most PHPer may have tried at some moments in their career life to make their own version of a wrapper of print_r to make it HTML friendly. Here are some handy code that I used for my tasks, they are truly great life savers at some particular moments.Most PHPer may have tried at some moments in their career life to make their own version of a wrapper of print_r to make it HTML friendly. .