Category: PHP

In our PHP session you will learn about PHP, and how to execute scripts on your application

Clearing Floats with Overflow using CSS

One of the common problems we face when coding with float based layouts is that the wrapper container doesn’t expand to the height of the child floating elements. The typical solution to fix this is by adding an element with clear float after the floating elements or adding a clearfix to the wrapper. But did …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/05/clearing-floats-with-overflow-using-css/

Difference between $this and self?

Inside a class definition, $this refers to the current object, while self refers to the current class. It is necessary to refer to a class element using self, and refer to an object element using $this. self::STAT // refer to a constant like this self::$stat // static variable $this->stat // refer to an object variable …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/04/difference-between-this-and-self/

What is the difference between padding and margins?

Margins and padding can be confusing to the web designer. After all, in some ways, they seem like the same thing white space around an image or object. Padding is the space inside the border between the border and the actual image or cell contents. In the image, the padding is the yellow area around …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/04/what-is-the-difference-between-padding-and-margins/

Double and Triple equals operator in PHP

Have you been given a piece of code to maintain that has single, double and triple equal operators in it? What’s the difference? Single Equals A single equal sign in PHP is an assignment operator. It assigns the value of the right side to the variable on the left side. For example: $name = “jon”; …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/04/double-and-triple-equals-operator-in-php/

Include a file and store contents to variable

This very handy feature of PHP which allows you to include a file but store the contents of the included file to a variable. This is particularly useful for PHP scripts and software which output content to a page by using variables. Many CMSs are built like this. The principal behind this solution is to …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/04/include-a-file-and-store-contents-to-variable/

Skip or Hide PHP errors / warnings

Errors are hints from compiler for the programmer to correct. But sometimes we face some unwanted or dynamic error. For example, $content = file_get_contents(https://blog.openshell.in/2011/01/execute-php-script-from-command-line-in-ubuntu/); Here , the url is invalid, or the server of the url is down , PHP shows Warning: Failed to open stream or file access is disabled. Use @ in front …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/01/skip-or-hide-php-errors-warnings/

How to Send Email from a PHP Script Using SMTP Authentication

Now you can send emails with SMTP authentication using this script. For most email uses, the free PEAR Mail package offers all the power and flexibility needed, and it authenticates with your desired outgoing mail server, too. For enhanced security, secure SSL connections are supported. Send Email from a PHP Script Using SMTP Authentication To …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-send-email-from-a-php-script-using-smtp-authentication/

Installing PEAR Mail for PHP On Ubuntu

It helps you how to make Ubuntu PHP localhost mail function work, using PHP to send mail from localhost is easy. First, you need to install some PEAR mail packages. In terminal, run the following command one by one: sudo apt-get install php-pear sudo pear install mail sudo pear install Net_SMTP sudo pear Auth_SASL sudo …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/01/installing-pear-mail-for-php-on-ubuntu/

How to Create a CAPTCHA with PHP

CAPTCHA is a simple test to determine if a user is a computer or a human. It is used to prevent spam abuse on the websites. So if you use CAPTCHA on your web site forms, this can help in stopping some bots and making life harder for other bots in accessing or using your …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-create-a-captcha-with-php/

How to Use External Font

Using External Font is very Easy 1.Download the font 2.If the Downloaded font is in ttf format convert it into eot format by a tool which you have to search and download or use this online convertor    http://www.kirsle.net/wizards/ttf2eot.cgi 3.If the Downloaded file is in otf format convert it into ttf format and then convert …

Continue reading

Permanent link to this article: https://blog.openshell.in/2011/01/how-to-use-external-font/