![](/images/ajax-loade.gif)
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 use get_browser() Function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use get_browser() Function in php ?
The get_browser() function returns the capabilities of the user's browser.
It looks up the user's browscap.ini file.
syntax of g...
Inserting array values at the beginning of an array in PHP
Hello Readers ,
With the use of array_unshift() , it will insert new values at the beginning of an array.
We can add one value, or as many as you like.
Syntax:
array_unshift(array,value1,value2,value3...)
Example:
<?php
$...
Removing duplicate values from an array in PHP
Hello Readers,
If we want to remove the duplicate values present in an array then their is a function named array_unique() that we can use .
If two or more array values are the same, the first appearance value will be kept and the other wil...
Range of an array in PHP
With use of range() function , it creates the array contains the range of an element.
It will return an array of element from low to high.
Syntax :
range(low,high,step)
Example :
<?php
$number = range(0,50,10);
print_r ($num...
Set up cookies in PHP
We can set the cookies with function called setcookie() . This function requires six arguments to be pass.
Syntax:
setcookie(name, value, expire, path, domain, security);
Creating cookies:
<?php
setcookie("name", "John Watkin...
How to delete last element in an array
Hello Readers ,
If we have an array and we want to delete the last record in an array then their is a function called array_pop() .
The array_pop() function deletes the last element of an array.
Example :
<?php
$a=array("red","gre...
How to insert more values in an array in PHP
Hello Readers ,
If we want to insert more records at the end of an array then their is function called array_push() that we can use.
Example :
If we have an existing array array("red","green"); and we want to insert two more values at th...
How to find the particular value in an array in PHP
Hello Readers ,
Most of the time in our application we need this function called in_array .
This function searches an array for a specific value.
Example :
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");
if (in_ar...
How to suffle an array in PHP
Hello Readers ,
If we have the certain array in php and we want to suffle the values of an array then we have the function called shuffle().
This function randomize the vales in an array.
Example :
<?php
$my_array = array("red","g...
How to combining two strings together in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss combining two strings together in PHP.
The PHP concatenate(.) is used for combining two string values and create one string.
you can see bellow example:
<?php
/...
How to use array_slice() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss array_slice() in php ?
The array_slice() function is used to for returning selected parts of an array.
syntax of array_slice()
array_slice(array,start,length,preserve...
How to get last key in an array in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to get last key in an array in PHP ?
we need in some cases the last key or last element of an array in PHP.
So We are using array_slice() function for getting only the ...
How to use key() finction in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss about key() function in php.
The key() function returns the index element of the current array position.
Or we can say that returns the element key from the current internal ...
How to use end() finction in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss about end() function.
The end() function is used for printing last element of an array.
It is advances array s internal pointer to the last element.
syntax of end() functio...
How to interchange values and keys of an array in PHP
Hello Readers ,
The array_flip() function exchanges all keys with their associated values in an array.
Say we have array array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow"); and we want to interchange key and values of an a...
array_fill_keys() in PHP
Hello Readers ,
The array_fill_keys() function fills an array with values, specifying keys.
For Example we have an array array("a","b","c","d"); and we want to put "blue" in all values of a key. See the below example.
<!DOCTYPE html&g...
array_diff_assoc() in PHP
Hello Readers ,
Suppose we have two three array it will search with all three arrays and return an array that contains the values from array 1 that are not present in rest of the array
Example :
<?php
$a1=array("a"=>"red","b"=&g...
How to count the value of an array in PHP
Their is function called "array_count_values()" which will count all the values of an array.
Lets suppose we have an array **array("A","Cat","Dog","A","Dog");** and we want to count the values of an array.
Example :
<!DOCTYPE html>...
Slug in PHP
Hi All,
Slug :- It is a part of the URL to makes the URL more user-friendly. There are also many other advantages of the Slug. Firstly, search engines such as Google will rank your page higher for the keywords contained in the URL Secondly, us...
How to use array_combine() in PHP.
Hello Readers ,
Suppose we have two array's .
$fname=array("Peter","Ben","Joe");
$age=array("35","37","43");
The array_combine() function creates an array by using the elements from one "keys" array and one "values" array.
Example ...
How to splits an array into chunks of new arrays
Hello Readers ,
If we want to split one array into bunches of new arrays then their is a PHP function named "array_chunk()" that we can use.
The array_chunk() function splits an array into chunks of new arrays.
<!DOCTYPE html>
<...
how to change all keys in an array to lowercase.
Hello Readers ,
If we want to change the array key lower case to uppercase and vice versa then their is PHP function array_change_key_case() .
Example.
<!DOCTYPE html>
<html>
<body>
<?php
$age=array("Peter"=...
Custom Pagination With Bootstrap
Hi All,
I recently required to created a custom pagination with the help of Bootstrap in my core PHP project. I thought that my code may help others also who wish to create the same.
The reason why I am using Bootstrap is as it ease our wor...
How can we prevent SQL-injection in PHP?
Hello Readers ,
For preventing SQL injection we can do by two ways :
1- > Escaping the special characters in your post or get variables , or
2-> By using a parameterized query.
Both would protect you from SQL injection.
Ex...
How to use base64_encode() in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss How to use base64_encode() in PHP ?
If you want to convert any string into MIME base64 then base64_encode() function is very useful and simple process
let see syntax of bas...
How to upload restricted image in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss How to upload restrict file in PHP ?
If you want upload only jpg, gif image and other type of images not allow to upload
then, you have to use bellow php code:
<?php
...
What is process to make custom session timeout in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss What is process to make custom session timeout in php ?
If you want to make the custom php session which will destroy automatic when page is not refreshing so long time.
yo...
How to pass an arrray in PHP via Ajax
Hello Readers if you want to send the array into another PHP page then you can use the code below:-
I have array made by function .push. In array is very large data. How is the best way send this to PHP script?
dataString = array(a->b);...
How to add two objects into one using PHP
Hello Reader's if you want to add two or more objects into one. Then you can see it into the example below:-
Ideally if you want the data to be together, you should have a parent class which has all these member functions and you should have a...
How to convert string to binary and binary to string using PHP
Hello Readers if you want to convert your string into binary using PHP then you can use the code syntax as below:-
$value = unpack('H*', "This string is converting into binary");
echo base_convert($value[1], 16, 2);
Output:-
010100110...
How to superimpose one image over another using PHP
Hello Readers if you have two images i.e. one png and one jpg, Then by using PHP you can merge both on a single one.
Lets see the example as given below:-
<?php
# If you don't know the type of image you are using as your originals.
$...
How to implode multi-dimensional array keys using PHP v5.5
Hello Readers, If you want to implode the array keys from multi-dimensional array then now PHP 5.5 offers you much easier way to do this.
Lets see the example as below:-
Array
(
[0] => Array
(
[studenID] =>...
What is process to convert string into an array using PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is process to convert string into an array using PHP ?
If you want to convert a string into a array then you should use str_split() function
let us know how it is works ...
What is process to unzip a file uisng PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is process to unzip a file uisng PHP ?
If you have a zip file and you want to unzip the file with php, then you should use zip_open().
This is very simple and useful f...
How to use json_decode() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use json_decode() function in php ?
So, Firstly let us know what is the use of json_decode() function ?
So json_decode() function is basically used for converting JSO...
Jquery ajax post example with PHP
Hello Readers ,
If you want to post the form but do not want to refresh the browser then the best approach to follow by using AJAX call .
Following is the HTML and Jquery code.
HTML:
<form id="foo">
<label for="bar">A...
Working example of data by PHP JSON Object
Hello Reader's If you want to know more about the PHP JSON Object then this blog will helps you. Lets see how to handle the working data of it.
<?php
$trends_url = "http://search.twitter.com/trends/daily.json";
// initialise the sessi...
Remove all special charracters and replace white spaces with hyphen "-" using PHP
Hello Readers! if you want to replace all the sepecial charracters from a string and replace white space by hyphen '-' then the code below will help you to learn:-
first we will replace all the white space with hyphen "-" from the string
fu...
How to make combinations by elements of array using PHP
Hello Reader's If you want to get all elements in the combinations then you can use PHP code to generate it.
Lets see the example as below:-
function pc_permute($items, $perms = array()) {
if (empty($items)) {
echo join(' ', $p...
Multuple deletion in Mysql using PHP
Hello Reader's If you want to handle your html form to delete multiple value at once then by using Check box in array you can do it.
lets see one example as below:-
<?php $sql = "SELECT * FROM guest_book";
$res...
How to get current unix timestamp in PHP
Hello Reader's if you want to get the current time stamp of Unix in PHP, Then PHP offers your to use this by getTimestamp().
Now let's see this in the example below:-
<?php
$date = new DateTime();
echo $date->getTimestamp();
?>
...
How to find elements from the group array in PHP
Hello Reader's! if you have set of arrays and you want to get all of them seperatly then the code below will help you.
Let's say if you have
[ [a], [b], [c], [a, b], [a, c], [b, c], [a, b, c] ]
and you want this
[a,b,c]
The c...
File upload in PHP.
Hello Reader's ,
While building any appication we definatley requires images to upload like profile image , company image etc , for this we require php file upload code .
You will get image data in array i.e. image name , temp name , image...
How to crop images in PHP
Hello Reader's if you want to crop the images and save them then you can use this code liberay, its a very easy to implement and very useful for thumbnail generation
<?php
$targ_w = $targ_h = 150;
$jpeg_quality = 90;
$src = 'demo_files...
Less than equal to query in codeigniter
Hello reader's If you are using codeigniter and want to make '<=' mysql query then you can use the code syntax as below:-
->select('COUNT(payment.keyid) AS rec_count')
->where('payment.paymentdate >=', $month_start)
->where...
What is the use of the @ symbol in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is the use of the @ symbol in PHP ?
so basically @ symbol is an "Error Control Operators" and it's works only on expressions.
In other word we can say that this symbo...
How to extract a number from a string in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to extract a number from a string in PHP ?
If you just want to filter the numbers out, the easiest is to use preg_replace() function.
It is very simple and easy function ...
How to use json_encode() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use json_encode() function in php ?
So, Firstly let us know what is the use of json_encode() function ?
JSON stands for JavaScript Object Notation. json_encode() is ...
What is the use of fgets() in PHP ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is the use of fgets in PHP ?
Firstly let us know what is fgets()
The fgets() function is used to return a line from an open file.
syntax of fgets()
fgets(file...
How to set different menu for different page in wordpress
We can set different menu links for every page in wordpress. Sometimes we get the requirements from the client to have different menu links for every pages. It can be done, Its quite coding part. For each pages we have to set different menus from...