Featured
-
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Best 5 Lightweight PHP Frameworks for REST APIs Development
Are you ready to develop the Rest AP
by ankur.kumar -
PHP: Full-Stack Framework vs Micro Framework
A web framework can be described as a software fra
by ankit.bhatia -
How to get facebook profile picture by Facebook App
If you would like to get your profile picture in f
by vivek.rastogi -
Creating RESTful API in cakephp
This tutorial will help you to learn how to create
by pushpendra.rawat
Tags
How to validate a given URL using PHP
Hello reader! If you have a to check the url is correct or not (not giving the status 404), Then you can get all the details of any url by using 'get_headers' in print_r.
Let's see the example below:-0
<?php
stream_context_set_default(
...
How to remove all special characters from a string using PHP
Hello Reader! If you want to remove all of the special charracter from a given string then PHP offers you to use 'preg_replace';
Lets see the example below:-
$GivenString = 'a2|"dM!@PO^&$f 12~';
$NewString = preg_replace('/[^A-Za-...
Use of '@' in PHP
Hello Reader!, You might have seen people using the '@' in the PHP coding. The operator '@' is used when you don't want to show the error messages even if they occur.
By using '@' the errors will be hidden.
Let's see the two syntax below:-
...
How to reindex array in php?
Hello Readers!, If you have an array whose key index are missing then you could use the 'array_values' function to easily reindex the array.
Let's see the example below:-
<?php
$array = array( 0 => 'string1', 2 => 'string2',...
How to find OS version from web browsers using PHP
Hello Reader! If you want to detect the OS version of user though the web browser.
Then you can use the library code below:-
<?php
$OSList = array
(
// Match user agent string with operating systems
'Windows 3.11' => 'Win16',
'Wi...
How to protect Joomla Administrator directory using htpasswd utility
.htpasswd file is just a simple text file which contains user name and encrypted password. It is Apache based login which protects and secure the specific directory on website and provide more security with the help of user name and password. ...
Convert local time to UTC format
Hello Guys,
Today we will learn how to convert the local time period into UTC format :
We will create a function with offset and time as parameter.Below is the code:
function
convertToUTC($DateTimeZone,$offset){
$DateTimeZone='201...
Integrate jQuery fullcalendar in cakephp
This tutorial will help user learn how to integrate the jQuery fullcalendar in our web application blogs etc.Below are the steps to integrate the fullcalendar:
Step 1:Write an action in an Eventcontroller let us say, event_calendar
path...
overloading and overridding in php
Hello Readers
overloading and overridding in php
In php overloading define functions have similar signatures but thy have different parameters.
Overriding means one class may have override the another methods where the parent class defin...
7 important plugins to use before starting a wordpress site
If you are going to start a website a blog or website in wordpress must install these plugins .
1-Akismet This plugin comes inbuilt in wordpress. This plugin removes and secure your wordpress sites from spams comments.
2- BackUpWordP...
Magic Constants in PHP
Hello Readers,
PHP Magic Constants:
There are many magic constants are available in PHP, but some magic constants are most important used in php, like LINE_, _DIR_, _FILE ,__CLASS__, __FUNCTION__etc. These constants are case-sensitive.
...
How to create new helper in codeigniter
Codeigniter gives the facility to create own helper according to requirement. You can code easily and call inside the codeigniter controller or model.
1) Create a file and put the following code into it.
if ( ! defined('BASEPATH')) exit('No...
Search product with category filter
Magento provide a quick search which search products globally inside site from any category but sometime we need to search the products of particular category. So below I am explaining the model we need to override and query which we need to modi...
How to print HTML page with tags using PHP
If you have any blogs or coding part that you need to show with the html tags, Then using PHP then you can perform this task
Lets say print the line below:-
<h1>I'm printing this line using the HTML tags</h1>
To print this...
How to get the user's time zone using PHP and Javascript
Hello Reader! If you developing the website for a global purpose then getting the time zone of your user is a important factor.
In the example below we'll see how to get the user's time zone by using JavaScript and PHP with a custom webpage.
...
How to add a PayPal button in Joomla?
At first you need to disable Tinymce editor in Joomla so that it does not strip out your HTML code.then go to site and click user manager and necessary user and choose no editor and then save. now in order to integrate Paypal button click artic...
How to convert an htaccess.txt file into a .htaccess file?
Change the configuration settings using directives in configuration files(.htaccess files) when using php as an apace module.Need to do "AllowoverrideAll" privileges to do so.If we don't have control over Apache configuration must use .htaccess ...
server side versus client side in php
Client side means the code runs on client machine namely like browser while server side means code runs on server side and sent output to the client.
In client side requests the pages from the server and displays them to the user in most of th...
How to detect web browser of user using PHP
Hello Reader! If you are developing the website which depends on user's web browser then you must first find out the web browser that is opened. By using PHP you can get easily this info using the library code below:-
<?php
function detec...
How to detect If user have internet explorer 8 or 9 or higher using PHP
On developing the customer user based web server, developer should choose all supported version of web browser and code according to web browser. If you are looking for detecting the version of all IE using PHP then the code below will help you p...
self versus $this in php
Hello Readers,
We can use the self in static function while this is not.
we can use accessible class variable and methods with self and this are:
for self self::
for this $this->
$this needs an instantiated object while self...
How to parse and Excel file in PHP
Hello Reader!
If you want to read a Excel file in PHP then you can learn the library code below
read('excel_file.xls'); // reads and stores the excel file data
// Test to see the excel data stored in $sheets property
var_export($excel...
How to get current date time with you region using PHP
If you are using PHP and want to get the current date time with respect to your time zone then just use the code below :-
$DateTime = new DateTime(null, new DateTimeZone('Asia/New Delhi'));
$DateTime->setTimezone(new DateTimeZone('Asia/Ne...
How to maximise the maximum size of POST in PHP
If your form sending much more POST request than the default size and you want to increase the size of POST then see the steps:-
Open the file php.ini
you can file the location of file from exicuting the PHP line below
<?php phpinfo(); ...
How to convert given seconds into day format using PHP
On converting the given time in seconds you have to follow the calculation in days and hours etc. Using PHP you can get the format by using the code below:-
Here I created the function ConvertToSec ($sec) as param:
function ConvertToSec($...
How to insert multiple rows into mysql by a single query using codeigniter
Most of time we need to insert multiple rows at a time into the database but some developer use multiple INSERT statements to insert multiple rows while it is a bad approach to solve this problem. Codeigniter provides a insert batch function.
Ex...
How to check if user's session is already started in PHP
If you want to know weather the session is already begin or not in PHP then, you can use of the syntax from PHP manual
see the example below
if (!isset($_SESSION)) session_start();
2.
And in case you are using PHP < 5.4 you hav...
How the see the body of a submit post using PHP
POST is a common mode of sending or passing the values from one page to another, But on getting what exact is inside the post PHP will offer you the code syntax.
Consider the example below:-
We will get the body part froma POST request or c...
How to get first n Characters from a given string using PHP
Hello Readers!
On a given string if you want to take out the first n number of characters from it then PHP offers you 'substr' to get the characters.
Consider an example below:-
Suppose I want to get the first 5 characters from string, $MySt...
Diffrence between print_r and echo in PHP
Although the syntax echo and print in php is almost do same function. On the performance based work there are some difference between then:-
Echo is much faster in performance than Print, Since it will not return any value.
On the basis of...
How to detect mobile device in website using PHP
If you want to know any mobile device is accessing your website, Then the easy way to detect device is to run a php code.
Lets see the code below :-
<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego)...
How to extract a number from given string using PHP
Using the PHP will give you several benefit to use code what you want.
And taking the number from any given string can be by diffrent - diffrent methods
lets se the example below:-
$myString = "I have 8 apples";
preg_match("|\d+|", $s, $myS...
How to make CSV File form array in PHP
Hello reader! If you have an array with the records and you want it to be download as CSV format. PHP has built in functions for making the format of CSV. Lets take the example below:-
header("Content-Type: text/csv");
header("Content-Disposi...
How to modify a Joomla Template?
To modify a Joomla Template you need to follow the steps given below:
Login to back-end of Joomla Site.
Click Extensions -> Template Manager. It will open the Template Manager : Styles
You can edit the template by clicking on the name o...
How to send SMS using PHP
Php offers you to make the integration of sms. We will discuss how to use php to send sms to any mobile number:-
Before we starts you need to have some any sms pack from mobile data companies but if you don't have you can make one you from twi...
Data formatter in YII
For make data more readable YII provide a application component name as 'formatter' by using this we can format our date,numbers,email.
How to use
$dataFormatter = \Yii::$app->formatter;
echo $dataFormatter->asDate('2016-01-01', '...
How to compare two variable floats using PHP
While making the calculation with float variable one should really careful since there can be three cases, It can < or > or =. So lets see the example below and learn how to get the comparative.
$varOne = round(0.250, 3);
varTwo = roun...
How to use file_get_contents in PHP
Php offers you to send data in various ways like get, post. Using php you can also use file_get_contents
to send data using url. Lets see an example below:-
$information = array('http' => array(
'method' => 'POST',
'content' ...
What are Site Backup Types in Joomla?
There are three commonly backup types.
1 Full Backup
It is also known as reference backup.whenever you do the backup type setting to full all the files and folder in the drive are backed up every time.So its a complete backup of all associ...
How to install Joomla using an Auto Installer
Using Auto installer in Joomla there is no requirement to create a database,upload files or configuration programs required. Using this it will reduce steps while installation and its fast to install and update. All will be done using auto instal...
Why there is a need of change in the name of default admin user after a new install?
While during Joomla installation default administrator account is created called "admin" as this name is well known due to which security is already exposed so anybody guess the password are able to access the admin account. As admin account is ...
Media Manager in Joomla
Media Manager manages the Joomla images. It uploads and deletes the files from [joomla root]/images/ directory. You can upload files, create directories and sub directories using this tool.
To access media manager click on Content -> Media ...
difference between die and exit in php
Hello Readers,
1. In php both die() and exit() are equivalent functions.
2. Basically die is used to throw an exception while exit is not, it is only used to exit the process.
3. The die() function is used to print the message and exit t...
How to make readable text from a pdf file in PHP
If you want to show a pdf file with the readable text from it on the page you can achieve it by seeing the code below
We will use a php library (pdfparser). This function will get the exact text as what you need
http://www.pdfparser.org/
...
PHP mail() function
To send email in PHP, we use mail() function. You can send text message, html message and attachment with message by the use of PHP mail() function.
Syntax
bool mail ( string $to , string $subject , string $message [, string $additional_hea...
How to add category in Joomla?
Categories in Joomla manages the articles. Articles have exactly one category. To create a category you need to follow the steps given below:
Login to the back-end of Joomla Site.
Click Content -> Category Manager ->Add New Category.
...
difference between echo and print in php
Hello Readers,
The below is the certain points which show the difference between echo and print in php:
Echo and print both are the statements in PHP.
Both are used to output data to the screen.
3. In php echo is faster than print b...
How to make download a file strictly in PHP
On the execution of exe file you must need the property of header like Description, Type and Disposition
For making the strict/force download of a file in PHP you have to use the code below:-
<?php
$FileName = "http://abc.com/exa...
How to implement Search Engine Friendly URLs (SEF)?
To implement Search Engine Friendly URLs (SEF) follow the steps given below:
Login to the back-end of the Joomla site.
Click System -> Global Configuration
Now click in the Site tab you will see SEO settings inside it.
Set Yes to "Use ...
Best method for running all HTML pages act as PHP files
If you need something like all of your's html pages to be run like php files you can do the steps below:-
Step 1
Create a .htaccess file on your root.
Step 2
And add the line below
AddType application/x-httpd-php .html .htm
Or if...