May 1st, 2013 by
laeeq |
Sometimes we need to wrap text to exactly accommodate a certain width of text or allowing browsers to wrap text whenever required. You can use PHP’s wordwrap() function to wrap a string into new lines when it reaches a specific length. This function limits text display to a particular column size, thereby allowing precise control over how text is rendered on a Web page. By default, wordwrap() wraps strings at column 75 using the standard newline sequence.
Read Full Post »
April 26th, 2013 by
laeeq |
The PHP development team announces the release of the 4th beta of PHP 5.5.0. This release fixes some bugs against beta 3 and cleans up some features.
PHP 5.5.0 beta 4 is shipped with some bug fixes. Here is the list:
- Fixed bug #64677, execution operator “ stealing surrounding arguments.
- Fixed bug #64342, ZipArchive::addFile() has to check for file existence.
- Fixed Windows x64 version of stream_socket_pair() and improved error handling.
- Remove curl stream wrappers.
Read Full Post »
April 13th, 2013 by
laeeq |
If you want interchange the keys and values of an associative array. It’s very easy, just use PHP’s array_flip() function which perform a very specialized task. It reverses the key-value relationship for all the elements of an associative array and returning a new array that is the mirror image of the original. Read Full Post »
April 5th, 2013 by
Adrian Stolarski |
When it comes to PHP, some 99% of amateur sites and 60-70% of all sites use the professional scripting language called PHP. But is it safe to use PHP? Does the implementation of the language not have any gaps that are critical to the operation of our applications? But remember that security problems do not arise just from the language itself, but also from the programming skills of those who write PHP scripts. Of course, most of the errors can be avoided. But, how can they be avoided? This article is an attempt to answer that question. We will discuss most of the issues with which we meet in life everyday. So let’s start our adventure. For the purposes of this article, we assumed that we do not have access to php.ini, and all operations will be performed from within PHP.
Read Full Post »
March 27th, 2013 by
laeeq |
Sometimes you want to extract the descriptive information embedded in an image, such as the metadata or thumbnails placed in digital photos. For this, you can use PHP’s Exchangeable Image File Format (EXIF) functions. EXIF is a standard for storing descriptive metadata in image files, particularly JPEG and TIFF files.
Read Full Post »
March 17th, 2013 by
laeeq |
If you want to protect a publicly displayed email address from being captured by an e-mail address harvester. To protect the email address, you can manage the email address which is only read by human being but not recognized as a standard e-mail address to a program. For I have a written a simple php function which convert special symbol in an email address with English words, making the e-mail address unrecognizable as such to an address harvester. So @ becomes at, _ becomes underscore, and – becomes dash. Read Full Post »
March 2nd, 2013 by
laeeq |
To convert a relative path to an absolute file path, use PHP’s realpath() function. This function performs “path math” means translating all the relative locations in a path string to return a complete absolute path.
If we pass “.” as parameter in below example
- <?php
- $abs_path = realpath(“.”);
- echo $abs_path;
- ?>
Read Full Post »
March 2nd, 2013 by
laeeq |
If you want to extract the path, file name, or extension path from a file path. You can use PHP’s pathinfo() function to automatically split the file path into its individual components.
Example code:
- <?php
- $path=“/etc/sendmail.cf”;
- $data=pathinfo($path);
- print_r($data);
- ?>
Read Full Post »
March 2nd, 2013 by
laeeq |
I think when sending content to users, there is no reason for HTML commends to be sent to the users. It generally increases load time. You can easily remove unwanted comments from html content using PHP regex.
You can use below PHP function:
- <?php
- function removeComments($html = ”) {
- return preg_replace(‘/<!–(.|\s)*?–>/’, ”, $html );
- }
- ?>
Read Full Post »
March 2nd, 2013 by
laeeq |
You know that you can get value entered by user with .htaccess pop-up? It’s actually very easy.
You can use this:
- <?php
- $_SERVER['REMOTE_USER'];
- ?>
Read Full Post »