Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
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 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
How to get Tree structure for array in php
Hello reader's I have created a conversion format that can convert array in tree structure.
In this code i use while loop but you can either use the recursive also. So here is the function as below:-
function treeze( &$a, $parent_key, $ch...
How to Automatically Start XAMPP Server in Ubuntu
Hello Guys,
What is XAMPP ?
As XAMPP is a user friendly application and very easy to install. It contain components like Apache web server application, Mysql Database , PHP and Perl programming support.
In my previous blog post, We d...
How to use ftp_size() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use ftp_size() function in php ?
The ftp_size() function is used for returning the size of a specified file on the FTP server.
This function returns the file size in byt...
How to use filesize() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use filesize() function in php ?
The filesize() function basically is used for returning the size of the specified file.
filesize() function returns the file size i...
How to use error_log() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use error_log() function in php ?
The error_log() function is used for sending an error message to a log, to a file, or to a mail account.
The error_log() function al...
How to use reset() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss the use of reset() function in php ?
So, basically The reset() function moves the internal pointer to the first element of the array.
syntax of reset() function
reset(ar...
How to use next() Function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use next() Function in php ?
This function returns the array value in the next place and outputs the next element in the array.
means we can say that it always returns...
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 hit MySql queries by using Angular JS
Hello Readers If you want to hit the MySql queries from another page by your current page, The by using Angular js you can do this. Also angular js will offers you to show your records in a pre formated desing.
Let's see the example as below:-
...
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 mulitple values to update records with a single query
Hello Readers if you want to update mulitple record by multiple id, then you have to use in clause in MySql
Lets see the example as below:-
$ids = array(474,25, 99,101);
Here I have an array $ids with multiple id's. Now this array w...
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] =>...
I'm getting import CSV error while uploading files in php
Hi i'm developing the panel where admin can import the csv file directly to mysql database. But I'm getting the error.
My code is
<?php
//ENTER THE RELEVANT INFO BELOW
$mysqlDatabaseName ='bilmos';
$mysqlUserName ='root';
$mysqlPasswor...
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...