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 current working directory in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to get current working directory in php ?
So basically The getcwd() function is used for returning the current working directory.
This function always returns the curre...
How to use opendir() Function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use opendir() function in php ?
The opendir() function is used to open a directory handle.
The opendir() function always returns a directory handle resource on succe...
How to use is_dir() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use is_dir() function in php ?
The is_dir() function is used for checking a specified file in a directory and returns TRUE if the directory exists.
syntax of is_dir...
How to use fstat() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use fstat() function in php ?
The fstat() function is used for returning information about an open file.
syntax of fstat() function
fstat(file)
file is a requir...
How to use readdir() function in php ?
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use readdir() function in php ?
The readdir() function is used for returning the name of the next entry in a directory.
This function returns the filename on succes...
Get result of two arrays into a single array
Hello Reader in this blog you will see how to get result of two arrays in a single array using PHP
Array one name information
Array
(
[0] => Array
(
[0] => 125479
...
How to increase or decrease dates in the given dates
Hello Reader's if you have the current date and you want to get some past dates or future dates then here you can see it. PHP offers you to use inbuilt function strtotime.
Lets see how you can adjust the dates with this.
Here you will get the ...
How to remove words which occurs mutliple times in a string using PHP
Hello Reader's If you have a string with words occurs more than two times then here you can see how to remove them as a single.
Lets see the string below full of random words and 34 is repeating.
$mystring = '2,34,two,findnerd,logic,66,34,5...
How to find words from a text file using PHP
Hi if you have a long text file full of line and you need to search some text in it then you can use this function. This function will accept the words from user then search from a text file and return the lines which have matching words.
<...
Object casting in PHP
Hello Reader's if you need to cast the objects in PHP then this blog is helpful to you .
Here below I created a function which will cast the object and relocate the object to location as you define
function cast($destination, $sourceObject)...
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.
$...