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 insert multiple records in Database?
We can insert multiple records in database using PHP. To do this, suppose we have database *example* having table demo with columns firstname, lastname, email. We need to insert multiple record in the table by using PHP. To insert the multiple re...
File Create/Write in PHP
Create File in PHP
To create a file in PHP fopen() function is used i.e., the function that is used to open a file is also used to create a file. If we use, fopen function() to open a file and file doesn't exist, it will create a new file.
F...
How to find difference between two dates in php
We can easily find date difference in php by using strtotime which convert two dates to unix time once convert we can manipulate easily by calculating the number of seconds between them.Its the easy way to calculate different time periods.
$...
Override same default method in joomla component
In some cases we need to manipulate the data a bit before saving it. So there is a function called PrepareTable() in joomla which is declared under file modeladmin.php and it is located under the libraries/joomla/application/component folder and ...
How to open, read and close a file in PHP?
Open a file in PHP:
To open a file in PHP fopen() funtion is used. Syntax:
fopen(filename, mode)
filename is the name of the file you want open. mode can be r,w,a,x,r+,w+,a+,x+.
Read a file in PHP:
To read an open file fread() ...
Different ways to open file in PHP
Ways to open a file in PHP are given below:
1. r: Open a file for read only. File pointer points at the beginning of the file.
2. w: Open a file for write only. File pointer begins at the beginning of the file. It erases all the data of th...
Display validation messages of multiple models in cakephp
First need to create a model relationship lets assume that a user registration form and for each and every user has a profile.so there is one to one relationship between user model and profile model.
<?php
class User extends AppModel {
...
Save CakePHP session in Database ?
How to save CakePHP session in Database ?
To store session in Database, you need to create a table in DB so that you can store the session in it.
Follow below steps.
1. Create a table in DB
CREATE TABLE IF NOT EXISTS `users` (
`id` VARCH...
How to filter WooCommerce products by custom attribute
Hello Everyone, in this blog I teach you how to filter WooCommerce products by custom attribute.
There are wide range of filter Plugins for filter product with custom attribute in WooCommerce like :
1. YITH WooCommerce Ajax Product Filter
...
CURL setup in php
Welcome to FindNerd. We are going to discuss the curl setup in php. In php curl is not enabled bydefault. You need to enable it via php.ini file. curl_init and curl_setopt
are the functions for main functionality. you can set the url by curl_ini...
CodeIgniter file structure
Right now that you've got CodeIgniter delivered electronically in addition to unzipped, create a second to think about the actual document design. Under shows the original folder design an individual ll see.
You can see above three folder...
Cron job process in wordress
Welcome to FindNerd. Today we are going to discuss the concept of cron in wordpress, how we can set up the cron in wordpress. We use the cron_schedules filter to set
the time intervak to schedule, ewp_send_email_cron_hook function to check the n...
serialize and unserialize function in php
Serialize is a function which is used to convert a storable representation of a value. It converts an array into string containing a byte stream representation of a value.
<?php
$serializeddata = serialize(array('apple', 'mango', ...
How to get the base url in cakephp ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to get the base url in cakephp ?
If you want current base or Get current url.
You can take reference of bellow example
suppose your project URL is http://localhost/pro...
What is proccess to get the file extension in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss What is process to get file extension in PHP ?
There are many ways for getting the file format or extension of any file.
In bellow example you can see how to get the file forma...
How to delete cache in magento
We can remove the cache from the root folder of the magento in the root path by deleting the files in cache folder of the path /opt/lampp/htdocs/magento/var/cache
The another way is to delete magento cache by usign magento admin panel as :
...
Joomla session
Sessions provide a very easy way to make data persistent without the need to constantly pass it through URL's or hidden form fields.It is used to store user data over certain period.It is stored on web server.
create session object.
Session ...
Convert string into lowercase and uppercase in PHP
Hello everyone, this article demonstrate some useful PHP functions which can be used to change string case into lowercase and uppercase. The article also demonstrate some other functions which can be used to convert first character of each word i...
Secure file download in php
Welcome to FindNerd. Today we are going to discuss the concept to download a file securely in php. We all knows, we can not share a adjust file location to end user.
We can set the header for file name, type and size. Please check the below code...
How to create joomla plugins
Plugin is an extension which provides a function that is associated with any trigger events. Following are the files required for creating a simple custom plugin in Joomla.
1 myfirsttest.xml
2 myfirsttest.php
3 index.html
First for creati...
How to remove parent theme Action and Filter in wordpress child theme
Hello readers, today we discussed about How to remove parent theme Action and Filter in wordpress child theme.
Some theme have its own hook function that change theme behavior and functionality.
Some example are below, Right now I am not goin...
How to remove parent(or default) javascripts and css in WordPress child theme?
Hello readers, today I will guide you about How to remove parent(or default) JavaScript and css in wordpress child theme.
There are 2 ways to add css and js in your wordpress project.
header.php
functions.php
The below code defines ...
How to remove parent metabox in wordpress child theme
Hello Everyone, today I guide you to remove parent metabox in WordPress child theme.
You can use remove_meta_box() function for removing parent theme metabox in WordPress child theme.
Put the below code into your child theme functions.php...
How to read data from CSV file
In PHP it is very easy to read data from CSV file using fgetcsv(), which is used to read data from a CSV file. This function reads each line of a CSV file and assign values into an array. The function returns the array of CSV fields. It returns F...
What is diffrence between echo and print in PHP ?
Hello all,
Welcome to FindNerd, today we are going to discuss the difference between echo and print statement in PHP ?
echo and print both are used to printing a statement.
So here are few important point given below to differentiate bet...
How to restrict the file type to be upload using PHP
Hello Reader's If you are uploading the attachments with only selected file types then you have to use inarray function.
Let's see the example as below:-
Put the allowed types in an array and use in_array().
$file_type = $_FILES['foreign_...
How to list the visitor to your website using PHP
Hello Reader's if you want to know the users which are accessing your website then you can get them by their IP. Lets see the example as below:-
Try this simple PHP function.
<?php
function ip_info($ip = NULL, $purpose = "location", $...
How to make PHP page as an image in return
Hello Reader's If you have to return a image from PHP page. then you can use the code as written below:-
<?php
// open the file in a binary mode
$name = './img/ok.png';
$fp = fopen($name, 'rb');
// send the right headers
header("Cont...
How to create coma separated string from an array
Hello Reader's if you have an array and you want it to converted into string with separated by coma then by using PHP you can do this as follow:-
You have to use Implode function
$arr = array(1,2,3,4,5,6,7,8,9);
$string = rtrim(implode(...
How to get the name and details of function being called by PHP
Hello Reader's! if you want to get the name of function and method being called, Then by using PHP you can do this as explain below:-
Lets's see the example as below:-
We use the info provided by a php exception, it's an elegant solution:
fu...
How to send email using Wamp server in PHP
Hello Reader's If you are working on your local host and not able to send the email then by configuring your WAMP server you can send email.
Let's see how it is done:-
First just install Fake Sendmail (download sendmail.zip). Then configure ...
How to select images from database and show on page
Hello Reader's! If you have stored the image in database as blob. Then you need a php code to retrieve them and a html page to show them. Lets see an example below how to show them
First create a php page getImage.php and code as written below...
What to you mean by variable $this mean in PHP?
Hello Reader's!
If you have any doubt with the $this in PHP then you can see the example as below:-
<?php
class Person {
public $name;
function __construct( $name ) {
$this->name = $name;
}
};
$t...
How to remove extra white spaces from string using PHP
Hello Reader's! if you are dealing with excess whitespace on the beginning or end of the string then you can use trim(), ltrim() or rtrim() to remove them. Also If have to delete extra spaces within a string consider a preg_replace() of multiple ...
How to dynamic generate password in PHP
Hello Reader's If you want to genrate password in PHP then you can use the code as below:-
you just have to try this, use strlen instead of count, because count on a string is always 1:-
function randomPassword() {
$alphabet = 'abcdefg...
How to unlink a directory by using PHP
Hello Reader's If you want to delete a folder and all the files in it then by using PHP recursive function you can do it.
Let's see on example as follows:-
Before deleting the folder, delete all it's files and folders (and this means recurs...
How to get dates between two given dates in PHP
Hello Readers's if you want to get a recursive set of dates between two given dates, For example
10-12-2105 to 19-12-2015 there are 9 days all will have different dates. By using PHP you can get this as using the code below:-
$startTime = st...
Difference between include and require in php
Hello Reader's If you are new to php then you must have to understand the difference between include and require, Lets see some of major difference between them.
Using require means your script will halt if it can't load the specified file, an...
How to adjust height of animated GIF file using PHP
First of all you just have to create 3 folder name
1.frame_output
2.images
3.resized_frame_output
Now download encoder and decoder class from this below link
here.
And Download class "GIFDecoder.class.php", Download class "GIFEncoder...
How to convert Image into base64 encoding using PHP
Hello Reader's!
If you want to to encode an image with base64 then by using PHP you can do such. You can use the code as below:-
This method is very simple and commonly used:
function getDataURI($imagePath) {
$finfo = new finfo(FILEI...
How to delete characters which can not be printable
Hello Reader's if your page is generating some non readable characters that are not able to print then by using PHP you can remove them as follows:-
Many of the other answers here do not take into account unicode characters (e.g. ). In this c...
How you can set multiple checkbox in an array using PHP
Hello Reader's if you want to send the checkbox in post for this you have to pass the form name as an array and afterwards you can access all checked boxes using the var itself which would then be an array.
Lets consider the example below:-
&...
How to fix HTTP header to UTF-8 using PHP
Hello Reader's If you want to set the HTTP header to UTF-8 then html will itself allows you to convert it. But if you want it to be wrap by using PHP then you can use the code below:-
You just have to use header to modify the HTTP header:
...
How to get the text matter from a given PDF using PHP
Hello Reader's, If you want to write a program that takes the matter from a given PDF then now you can use many libraries. These are well function performing and easy to use.
Lets see an example below:-
Download the class.pdf2text.php from he...
How to get all folders in a given folder using PHP
Hello Reader's! If you want to get all of the folder inside a given directory then PHP offers you many ways to do that, Lets see them from the basic programs.
you can use glob() with GLOB_ONLYDIR option
here's how you can see how to retrieve...
Difference between PHP $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']
Hello Reader's!
In working PHP you might have seen the two common syntax $_SERVER['HTTP_HOST'] and $_SERVER['SERVER_NAME']. They share similar name but they work different.
$_SERVER['SERVER_NAME'] gives the value of the server name as defin...
sessions in cakephp
Session component provides a way to persist the data between HTTP requests.
We can put any value to name and by this way we can write the session.
SessionComponent::write($name, $value)
$this->Session->write('User.fruit, 'apple');
...
How to change site URL in Wordpress
In the case of server migration like uploading site from local server to live server etc. We need to change the siteurl. Please follow the below instruction to change SITEURL
1) Open PHPMYADMIN of your new server.
2) Open wp_options DB table....
Uninstalling Drupal 7 themes
Hello friends,
If you want to uninstall the Drupal 7 theme from your Drupal installation then just follow the below simple steps-
1. Uninstalling a theme is a simple process, it just the reverse of installing a theme.
2. Access the t...
How to install a Drupal 7 theme
There are 2 ways to install drupoal themes one is automatically from the admin interface.
Automattic Installation
Log in as site administrator go to the theme manager by selecting Appearance and here you will find two option to install ...