Sending Emails using PHP

PHP must be configured correctly in the php.ini file with the details of how your system sends email. Open php.ini file available in /etc/ directory and find the section headed [mail function]. Windows users should ensure that two directives are supplied. The first is called SMTP that defines your email server address. The second is …

file handling in php

This chapter will explain following functions related to files − Opening a file Reading a file Writing a file Closing a file Opening and Closing Files The PHP fopen() function is used to open a file. It requires two arguments stating first the file name and then mode in which to operate. Files modes can …

function in php

PHP functions are similar to other programming languages. A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value. You already have seen many functions like fopen() and fread() etc. They are built-in functions but PHP gives you option to create …

Array in php

What is PHP Arrays Arrays are complex variables that allow us to store more than one value or a group of values under a single variable name. Let’s suppose you want to store colors in your PHP script. An array is a data structure that stores one or more similar type of values in a …

control structures in php

Control Structures Control Structures are loops, like for, and conditionals, such as if. Most of these will be familiar to the javascript programmer, and this page is basically a list. The following exist in php: if and else These are exactly the same as javascript and other languages. if ($a==$b) { print “The same”; } …

Operators In PHP

What is Operator? Simple answer can be given using expression 4 + 5 is equal to 9. Here 4 and 5 are called operands and + is called operator. PHP language supports following type of operators. Arithmetic Operators Comparison Operators Logical (or Relational) Operators Assignment Operators Conditional (or ternary) Operators Lets have a look on …

PHP Variables and Constants

Variables are used for storing values that can change over the course of a script, whereas the constants are used for storing fixed values that doesn’t change. The main way to store information in the middle of a PHP program is by using a variable. Here are the most important things to know about variables …

JSON encode and decode on PHP

JSON makes dealing with data in your app exceptionally easy and manageable. The best part about JSON is you can look at it and understand it. It’s not like the confusing spaghetti DOM that you get with XML, it’s a lean minimal representation of your data. If you’re dealing with chunks of data in your …

PHP include and require Statements

It is possible to insert the content of one PHP file into another PHP file (before the server executes it), with the include or require statement. The include and require statements are identical, except upon failure: require will produce a fatal error (E_COMPILE_ERROR) and stop the script include will only produce a warning (E_WARNING) and …