You are here:Home arrow Home arrow PHP
  • Narrow screen resolution
  • Wide screen resolution
  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • green color
  • blue color

PHP: Native code, Zend Framework and RapidPHP

Watch a Log file for changes

Here is how to watch a log file for changes in a Linux command shell.

Function to format filesize

This lightweight function will display file size in a user friendly format without much effort. I.e.: // will output i.e. 1KB (function always accepts bytes value)
echo convert(1024);

Getting MIME of remote file with Zend Framework

If you ever need to get content type of remote file from within PHP, this class will come in handy. Supposing you need to check external link if it is an mp3 file. You will be able to do this: $sniffer = new Smartycode_Http_Mime();
$contentType = $sniffer->getMime($url);
if('audio/mpeg3' == $contentType) echo 'It is MP3';

PHP code check

I've started working on PHP Code Check online tool, you can test early version of it here. Internally, it's based on CodeSniffer parser. I am looking forward on to providing more options like uploading files (single or zipped package), prettier output and detailed explanation of errors. This will target Zend coding standards, however other standards might be provided later. Happy testing, and please comment and give your feedback here. Thanks.

Code autocomplete for array objects (foreach)

Here is a quick tip on enabling code auto-completion on array of objects (i.e. when you fetch array of objects from a database table adapter).
<< Start < Prev 1 2 Next > End >>
Results 1 - 9 of 16