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 make validation for credit card using PHP
Hello Reader's if you need to make validation of credit GivenCard using PHP then is blog will be helpful to you.
This is only making the validation on user side you should better use seconder validation on payment gate way also.
So the code lib...
How to check if a given date is Sunday by PHP
Hello Reader's if you are looking for making the function which detect if a given date is weekend or not then this code will help you. This is a PHP function which will use the date as a input param and will print if its weekend or not.
So the ...
How to set anchor on email and urls using PHP
Hello Reader's!
If you are looking for code that make your plain MyStringPlainText urls and emails into anchor format then you can use the code function as below:-
<?
function SetTheAnchor($MyStringPlainText)
{
$MyStringPlainT...
How to get current file name in PHP
Hello Readers if you getting in codition where you have to find the current file name then this blog is very helpful to you.
Suppose you are making user redirect only when he is in account.php then you just have to fine the file name.
<?p...
How to get playtime, height and width of a vedio by PHP
Hello Reader's if you want to get the details about the vedio from your local server then you can use the code liberary as below:-
$ffmpeg_path = 'ffmpeg'; //or: /usr/bin/ffmpeg - depends on your installation
$vid = 'PATH/TO/VIDEO'; //Rep...
How to run php code when click action occur on link
Hello Reader's, If you want to run PHP code when user click any selected anchor tag then you can use the Jquery for this. Lets see how you can run this code.
First you have to write the onlclick action on the anchor tag like this:-
<a hr...
Filtering the external input data in php
Here we will learn about the filter functions that are used to validate and sanitize the data and make sure that data is in proper form and all the illegal characters are removed from the data.The filter function are:
filter_has_var()
filter_id...
Different ways to round number to 2 decimal places in PHP
Many times we need to format a number with two decimal points, PHP provides many solutions for rounding a number with decimal values. This tutorial list some functions which can be used to round a number with decimal values upto 2 decimal points....
Cakephp putting condition on virtualFields
Hi Readers,
Today I will be discussing about the limitation of virtualfields and how can we overcome it's limitations. Firstly, we can not use virtualfields in associated models for conditions,fields arrays or order. Doing so will general...
PHP Condition checking on multidimensional array
Hi Readers,
We all have used array_values, but we use array_values just to get the values from an array. However, we can do much more than that with the help of it.
One of it's alternative use of array_values is in a situation wher...
array_fill() vs array_fill_keys() in PHP
This tutorial explains the difference between array_fill() and array_fill_keys() functions, which are used to initialize or fill an array with values. The main difference is in the method of filling values in array by both functions. The details ...
How to create table using PDO in PHP?
PDO is PHP Data Objects which is used to connect to any database. Benefit of using PDO is that if there is any problem in our query it has an exception class to handle it. If any exception thrown to the try block, the script stops and directly fl...
How to convert a string to uppercase and lowercase?
Convert a string to uppercase:
strtoupper() function is used to convert a string to uppercase. It convert all characters of string to uppercase.
Syntax:
strtoupper(string)
You have to pass only one parameter to the function i.e., th...
How to remove index.php in Codelgniter URL
Hello Friends,
If you are looking to remove index.php from URL. By default Codelginter Path will appear like this "http://www.abc.com/index.php/users/userinfo", if you want to change this with "http://www.abc.com/users/userinfo"
//Replace y...
How to covert first character and every word of a string to Uppercase?
Convert first character to uppercase:
To convert first character of a string to uppercase we use a function in PHP ucfirst().
Syntax:
ucfirst(string)
This function includes only one parameter that is the string whose first character...
aggregrate function mysql
Aggregrate function is a function which returns single value by performing a calculation on a set of values.MySQL provides many aggregate functions such as AVG, COUNT, SUM, MIN, MAX, etc.
MIN returns the smallest value in a given column
MI...
How to add custom logo in wordpress
Many of the wordpress themes are having options in admin panel for uploading and changing the logo. But if we want to make a custom logo that is used in converting HTML to wordpress or for making any custom wordpress theme or we do not have any o...
How to use library in Zend Framework
Hello Friends,
If you are you looking to implement any Zend library in your development. Please follow the below example for the same. Here we are using mailing library in the below example:
1) Include library path as below
include '/def...
cal_info() Function
cal_info() Function in PHP as the name suggests, is the function that returns the information about a particular calender that you have specified.
Syntax:
cal_info(calendar);
In above function there is only one parameter which is the c...
How to convert XML to JSON using PHP
Hello readers, In this blog I guide you "How to convert XML to JSON using PHP"
Below is the 2 example converting XML to JSON.
1. example
$xml = simplexml_load_string($xml_string);
$json = json_encode($xml);
$array = json_decode($json,T...
How to convert hexadecimal values to ASCII characters?
To convert hexadecimal values to ASCII characters we will use a PHP function hex2bin().
Syntax:
hex2bin(string);
In above line we have a passed a parameter string in the function which is basically the hexadecimal value that we need t...
What is the difference between isset and array_key_exists in PHP
Hello Everyone today I guide you "What is the difference between isset and array_key_exists in PHP"
The below example helps you to differentiate between isset() and array_key_exists() .
isset() will only return true or false
array_key_exists...
How to write custom mysql query in CakePHP
Hello Friends,
Some time we need implement custom mysql queries in CakePHP. If you are looking to implement custom mysql query in cake php please follow the below example:
// Define your query and replace this with query written below
$qu...
mysqli_num_fields() in PHP
The mysqli_num_fields() function is used to display the number of fields in a result set. In other words, you can say that it returns the number of columns that is coming from a select query.
Syntax:
mysqli_num_fields(result);
In above...
Filtering multiple variables
Here we will learn how to filter multiple variable using the filter_var_array() function.It returns an array of values for all the requested variables else it will return FALSE if failed.
Example
$abcd = array
(
"firstname" =>...
What does keyword 'var' do in PHP
Hello readers, In this blog I will help you to know "What does keyword 'var' do in PHP ?"
It's regarding declaring class new member factors inside PHP4, and it will no longer needed. It'll operate inside PHP5, however it will increase an E_STR...
how to detect search engine bots using php
Hello readers today I will guide you "To detect search engine bots using php".
Search Engine Bots:- Search engines refers to, generally people which make use of programmed software program providers referred to as spiders, crawlers, software i...
How to display random image from a directory?
To display images from a directory randomly first of all we will give the path to the directory. Then we will select the directory. After that we will open the directory and will get all the files of the directory.
<?php
$Image_Path = "";...
How to integrate adaptive payment in php
Adaptive payment provides facility to allow payment between sender and multiple recievers.
Steps for adaptive payment are as follows:-
1 First need to create app for paypal.
Get username,passsword,applicationid and signature recieved fr...
How to list files in a directory with no subdirectories?
In PHP, we can list files with no sub-directories. To understand this we will take a example. Suppose we have a directory demo whose files we want to list inside a drop down box. We will take a form then open the directory whose files we want to ...
How to set the time for session cache expire in php
Here we will learn with the help of an example that how we can set the time for session cache expire in php. We use a function session_cache_expire() which returns the current setting of session.cache_expire.
Example
<?php
/*Here ...
Swap keys with their associated values in an array using PHP
This article demonstrates a PHP function which can be used for swapping of keys with values in an array. array_flip() is the function which accepts an array as parameter and exchange the keys with their associated values in an array. This functio...
How to use array_reverse() in PHP
array_reverse() function reset the order of elements in an array in reverse order. The function takes an array as argument and return an array containing all values in reverse order. The function also reset the index of elements. To keep the inde...
Use of array_intersect() in PHP
The array_intersect() is a built-in function in PHP used for computing the intersection of two or more arrays. The function takes two or more arrays as arguments, after comparing values of arrays the function returns an array containing all valu...
How to update record in Codelgniter
Hello Friends
If you are looking to update records in Codelgniter. Please follow the code for the same:
// Define the array with your db attribute as key and your updated data as value
$data = array(
'country_name' => $country...
How to Crop image in codelgniter
Hello Friends,
If you are looking to create crop functionality in Codelgniter. This very simple in this framework, please follow the below code for the same:
$cropConfig['image_library'] = 'imagemagick';
$cropConfig['library_path'] = '/def...
How to use Aggregate functions in codelgniter
Hello Friends,
If you are looking to add aggregate functions(MAX, MIN, AVG, SUM) in Codelgniter. Please use the below code for the same:
// Use Max function to get maximum salary in employee table
$this->db->select_max('salary');
$q...
Format numbers using number_format() in PHP
number_format() is one of the most popular PHP function which is used to format numbers with grouped thousands.
Syntax : number_format(number, decimal_values, decimal_point, thousand_separator)
number : The number which has to be formatted.
de...
How to add watermark in Codelgniter
Hello Friends,
If you are looking to add watermark in the images under Codelgniter framework. Please follow the below code for the same:
// Set your source image path
$watermark_config['source_image'] = '/define/path/of/your/image';
// ...
How to get last insert id in Wordpress
Hello Friends,
Programmer generally need last insert id for their coding requirement. If you are new in Wordpress and you need to fetch last insert id after insertion. Please follow the code below:
// Define the DB object
global $wpdb;
...
How to create database in MySQL using PHP?
In PHP, to create database in MySQL functions mysql_create_db() or mysql_query() is used. To create database using mysql mysql_create_db() syntax is as follows:
mysql_create_db($dbname);
For example:
Suppose we want to create a database...
Compute difference between two arrays in PHP
This article defines an array function of PHP, which is used to find the difference between two arrays. The details of function are given below :
array_diff() : array_diff() is used to compare two or more arrays to find the difference. The fun...
Laravel 5.0 Illuminate, Facades, Service Container, Service Providers
Hi Readers,
If you are new to Laravel 5 you will definitely come across following terms and you will be using them without actually understanding what they stands for. But it always helpful to understand what are they stands for and why do...
How to run mysql join in Codelgniter
Hello Friends,
If you are looking for mysql join in codelgniter. Please review the code as below:
// Initialize select query
$this->db->select('*');
$this->db->from('users');
// Define join in last parameter define left ...
Laravel 5.0 Difference between Fillable and Guarded
Hi Readers,
If you are new to Laravel you will definitely come across two properties in the model one is Fillable and another one is Guarded. I myself did not get the use of these properties but once I get along I understood the actual use...
How to insert multiple records into MySQL Using MySQLi/PDO
Here we will learn how to insert multiple records into MySQL Using MySQLi/PDO using the mysqli_query()/exec function in MySQLi and PDO respectively.The examples below insert two new records to the "Employee" table:
For example:
MySQLi m...
Deleting Data in cakephp2.x
If we are required to delete a record, cakephp 's model class offers a way for the same.
Deleting the record with the perticular id can be done by using delete() function :
delete(integer $id = null, boolean $cascade = true);
The abo...
How to run select query in Codelgniter
Hello Friends,
If you are looking to execute select query in codelgniter. Please review the code below:
// Pass the table attributes you need to fetch
$this->db->select('id, first_name, lastname');
OR
$this->db->select('*'...
How to Sanitize Email ID and URL in PHP
Hello Everyone, today I will guide you "To Sanitize a String in PHP"
SANITIZE :- Data affirmation is usually an inclusive element of working with varieties. Not merely may be published files result in protection problems, nevertheless addition...
How to removes a directory in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to removes a directory in php ?
If you want removes a directory then you should use The rmdir() function that is removes an empty directory.
The rmdir() function retu...