Resizing images goes a long way

One of the most small but extremely important aspects of PHP programming that many programmers overlook is the failure to resize images. Of course when we say it’s common sense that websites with smaller images load faster than ones with bigger images, it’s as obvious as saying that the sky is blue.

However, since it is precisely assumed to be “common sense”, it is one of the aspects of PHP programming that is most often not given a moment’s notice. Simply upload the picture, and it’s all done. Which is a terrible disservice, actually, to the website you’re making. People who visit it will most likely be turned off my the long loading times, and with peoples attention span as it is, you’re bound to be shoved aside in favor of a faster loading site.

Zend - PHP to the Max

phpstackThe announcement of Sun that they are developing the Zend Platform, is set to revolutionize the internet which is ruled by PHP based applications. Web sites, apps and many more all use PHP as their main platform and what better way to boost it’s reach is the addition of it’s own proprietary platform that would allow developers to use it as if PHP was made for commercial or business applications. Much of the market that Microsoft still holds is on their business development platforms such as the .NET framework which is mandatory for all of their business applications such as those for financial and other uses. The boost would allow more stable use of the PHP language, maximizing the potential for more business. Sun Microsystems, one of the leading proponents of the Zend. It adds capabilities to other development platforms, yes even Microsoft’s to inter-communicate and work together combining the efforts of all the major developers in the world.

PHP 5.2.8. the safer version

Time to upgrade to PHP version 5.2.8. as PHP 5.2.7. is a security liability:

Due to a security bug found in the PHP 5.2.7 release, it has been removed from distribution. The bug affects configurations where magic_quotes_gpc is enabled, because it remains off even when set to on. In the meantime, use PHP 5.2.6 until PHP 5.2.8 is later released.

The PHP Development Team would like to announce the immediate availability of PHP 5.2.8. This release addresses a regression introduced by 5.2.7 in regard to the magic_quotes functionality, which was broken by an incorrect fix to the filter extension. All users who have upgraded to 5.2.7 are encouraged to upgrade to this release. Alternatively you can apply a work-around for the bug by changing “filter.default_flags=0? in php.ini.

Take out 5.2.7. as soon as possible and use the newest one for security’s sake!

Source

Time and Date Function

Image Source:

One of the most important simple functions we use when we work on PHP is the Time and Date functions. It performs two things. The Time () function being responsible for the assignment of each date and time, a number string that is based in seconds. The Date () function meanwhile, is responsible in formatting this number string into a human friendly display. There are also other important functions worth mentioning. The Mktime () function is utilized to generate artificially the time stamp for a certain date and time. It has the same function as the time() but its different because this is used for a particular date not necessarily the present day. In counting down function, there is a simple script that can be used , it called Countdown script.

Whats next for PHP?

Image Source:filemaker.com

When you’ve finished studying the learning curbs of PHP5, you will most likely wonder what is in store for PHP development in the near future. Where will this indispensable programming language headed in the next year? As we all know, PHP 5 has been a very significant development for the programming language. PHP5 has simply set the standard of many features that had little support before. Or simply was not focused on. It revolutionized the language, practically. And it really live up to its predecessor, PHP4. PHP5 as major version will be around 3 to 4 years much like PHP4 which was released in 2000. It had undergone a number of important revisions as it moved along. Definitely, PHP5 will see some minor patch releases. it will correct bugs from the original PHP5 . But it definitely will provide us with newest functionalities to use and do things with. So enjoy using your favorite PHP5. It will be here to stay and be helpful to you.

The HTTP Header


Image Source: content.answers.com

People who are just starting to learn HTML may hear developers terms such as HTTP header and simply think that it is the same with a header of an HTML document. Big Mistake. The HTML header is anything you write in between the tags. The HTML header usually contains information about the page. The author provides the info for the client. The HTTP header, otherwise, is information the client and the server provides with each other regarding the transmission process of the document. Think of the HTML header as the date and address written at the top of a business letter, while the HTTP header is the address written on the envelope. They are both addresses, written in two different locations.

The HTTP header contains details about the transaction between the client and server, with slight variations depending on whether it is a request or a response. The header information can be grouped into three different categories. Namely, General, Entity, and Request/Response

Things To Remember on PHP


Image Source:www.faqs.org

Do you know what if felt like when you’re forgetting something and you promised to remember even just for one day? It felt like not having sessions in your website. Sessions in PHP temporarily saves important data that is needed for browsing the whole site, into the server for future references. Therefore, it will not take any of the user’s memory space. In our school, session is commonly used when the user has to log in first before entering. With session, his username and password won’t have to be displayed in the address bar, or the programmer won’t have to use POST for all of his pages. There are three functions used in PHP for session. Session_start() is used for starting a session and must always be placed before the body tag. It creates a unique id (UID) for the user. Session_unset() removes all of the values stored in the session. Session_destroy() deletes the UID. To store data as a session variable, user $_SESSION[‘variablename*’] and equate it to the value you want to save.

*Can be changed into what the user prefers.

Arrays : Changing cases

This form of array declaration allows one to change the case from uppercase to lowercase and vice versa. The syntax goes as follows:

array_change_key_case(array,case)

The array part, specifies which table or array to use and is a required field which is not the case with the key which is automatically assigned a value. An example of it’s use can be seen below:

$a=array('a'=>“Mouse”,’b'=>”Rat”,’c'=>”Rodent”,’d'=>”Cat”);
print_r(array_change_key_case($a,CASE_UPPER));
?>

The output of the said commands will be:
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)

Another example of it’s use would be:

$a=array('a'=>“Mouse”,’B'=>”Rat”,’c'=>”Rodent”,’b'=>”Cat”);
print_r(array_change_key_case($a,CASE_UPPER));
?>

That returns the following values respectively:
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)

In the next post, we would discuss an array function that divides a large array into several chunks of separate arrays.

Getting Started with PHP Programming

The first step to get us on our way to programming in PHP would be to set up an ideal development environment. You need a Web Server software like Apache (which would be what we are going to use) which is only one of many out there. Most of these web servers are open-source meaning that they are free. Now, being free doesn�t mean that they are not up to standards for there are standards that are set by independent groups that are comprised of the many developers who together formulate or give a loosely defined set of standards for others to follow. Apache has versions for Linux but there are also for the Windows, Unix and Mac OS. The installer can be downloaded along with the detailed manual from PHP.net

Post Variable Continued and the $_REQUEST variable

The “welcome.php” file can now utilize the $_POST variable to catch the data contained within the form as with the request variable in the previous posts, the form fields will automatically be the ID keys in the $_POST array. This variable would be very useful for passwords and user name and other entry forms (having no limits on length) but being so discreet, it cannot be bookmarked.

Welcome .

You are years old!

The $_REQUEST Variable
The variable contains the contents of both $_GET, $_POST and $_COOKIE which can be used to get the result from the data sent with the GET and POST methods like the sample shown below.

Welcome .

You are years old!