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
Laravel 5.0 Grouping Similar Routing Requets Requests
In Laravel many times we need to group together many routing requests having same middleware, controller, suffix, etc. We can achieve that by using Route::group. The syntax of it is stated below.
Syntax :-
Route::group(["middleware" =&g...
How to use in_array in php to find value in a array list?
You can take reference form below example to find the value in an array list using php in_array.
Suppose you have a list of Favorite List items (for example a list of colors names) and you want search your color is exist in list or not exist.
...
Payment System with BrainTree PayPal using PHP
BrainTree is a very secure and easy to setup payment gateway. There are lots of features available in new Braintree and I found it very useful. Visit the link at the end of details:
Payment System with BrainTree PayPal using PHP
Are you wor...
Import Data from CSV file in Mysql Database
Hello friends,
I am sharing that how we can save csv file data in mysql database. Csv Data consists of rows and columns with comma separated.
for example we have a csv file which contains user first name, last name, age and designation.
li...
Insert and Remove value from begining of an array
This article demonstrate two predefined functions of PHP to add and remove values from begining of an array.
1.array_shift(): This function removes first element of an array and returns the removed value. The numeric keys of array are automat...
How to Add SEO Meta Tags in Wordpress without Plugins
Hello Guys,
There are number of click plugins available on internet for your seo needs but most of them have many complex function for simple needs. I am not saying that there is no good SEO plugins in the market but they are few like All ...
How to get the max value from given multidimensional array using PHP?
Hello Reader! If you having an multidiamensnal array and you want to get the max value from a single element key then you see the example below:-
[0] => stdClass Object
(
[id] => TRF1254
[cust] => CUST9897
...
How to Authenticate user in PHP using PDO
Hi friends,
If you are using PDO in php , Now you can Authenticate user using simple code.
include 'conn.php';
try
{
$username = $_POST['user'];
$password = $_POST['pass'];
$smt=$conn->prepare("SELECT * FROM signup WHER...
How to detect UTF encoding using PHP
Hello Readers! if you want to find out the type of file encoding using php then the code below will help you:-
//check string strict for encoding out of list of supported encodings
$enc = mb_detect_encoding($str, mb_list_encodings(), tr...
How to get color of image for the background using PHP
Hello Readers! If you are developing the dynamic website in which the image color will be the background color then you can see it doing in PHP :-
<?php
$filename = $_GET['filename'];
$image = imagecreatefromjpeg($filenam...
How to make text url to hyperlink using PHP
Hello Reader!, On printing the url in plain text, they do not appears as hyper linked but using PHP you can perform this.
Let's see the example below that takes a plan url as input and return the hyperlinked url:-
<?
function createHyper...
Difference in using session_unset() and session_destroy() in PHP
For just the functioning part both the syntax will work the same but by writing session_unset will clears the $_SESSION variable but will not destroy the variables and it will initialize to this stage:-
$_SESSION = array();
session_destro...
How to validate a given URL using PHP
Hello reader! If you have a to check the url is correct or not (not giving the status 404), Then you can get all the details of any url by using 'get_headers' in print_r.
Let's see the example below:-0
<?php
stream_context_set_default(
...
How to remove all special characters from a string using PHP
Hello Reader! If you want to remove all of the special charracter from a given string then PHP offers you to use 'preg_replace';
Lets see the example below:-
$GivenString = 'a2|"dM!@PO^&$f 12~';
$NewString = preg_replace('/[^A-Za-...
Use of '@' in PHP
Hello Reader!, You might have seen people using the '@' in the PHP coding. The operator '@' is used when you don't want to show the error messages even if they occur.
By using '@' the errors will be hidden.
Let's see the two syntax below:-
...
How to reindex array in php?
Hello Readers!, If you have an array whose key index are missing then you could use the 'array_values' function to easily reindex the array.
Let's see the example below:-
<?php
$array = array( 0 => 'string1', 2 => 'string2',...
How to find OS version from web browsers using PHP
Hello Reader! If you want to detect the OS version of user though the web browser.
Then you can use the library code below:-
<?php
$OSList = array
(
// Match user agent string with operating systems
'Windows 3.11' => 'Win16',
'Wi...
7 important plugins to use before starting a wordpress site
If you are going to start a website a blog or website in wordpress must install these plugins .
1-Akismet This plugin comes inbuilt in wordpress. This plugin removes and secure your wordpress sites from spams comments.
2- BackUpWordP...
how to print the HTML code in PHP
If you want to print the html tags and code inside the PHP code you can do it by putting all the html code inside the echo syntax:-
Consider the following two cases:-
1. In between PHP tags
<?php if(condition){ ?> //In this case th...
How to make multiple submit button in a form
Hello Reader if you need two or more submit button in a single html form then you learn from the code below:-
For the form the html will go like this:-
<input type="submit" name="submit_button" value="Submit" />
<input type="subm...
How to print HTML page with tags using PHP
If you have any blogs or coding part that you need to show with the html tags, Then using PHP then you can perform this task
Lets say print the line below:-
<h1>I'm printing this line using the HTML tags</h1>
To print this...
How to get the user's time zone using PHP and Javascript
Hello Reader! If you developing the website for a global purpose then getting the time zone of your user is a important factor.
In the example below we'll see how to get the user's time zone by using JavaScript and PHP with a custom webpage.
...
How to detect web browser of user using PHP
Hello Reader! If you are developing the website which depends on user's web browser then you must first find out the web browser that is opened. By using PHP you can get easily this info using the library code below:-
<?php
function detec...
How to detect If user have internet explorer 8 or 9 or higher using PHP
On developing the customer user based web server, developer should choose all supported version of web browser and code according to web browser. If you are looking for detecting the version of all IE using PHP then the code below will help you p...
How to upload multiple files using Jquery
Hello Reader's!. Now multiple files on a single getting in fashion so you can use any of the multiple upload library code, But here we'll see how to use Jquery and PHP to do the same
For getting it start we need a html form page and it'll go ...
How to parse and Excel file in PHP
Hello Reader!
If you want to read a Excel file in PHP then you can learn the library code below
read('excel_file.xls'); // reads and stores the excel file data
// Test to see the excel data stored in $sheets property
var_export($excel...
How to get current date time with you region using PHP
If you are using PHP and want to get the current date time with respect to your time zone then just use the code below :-
$DateTime = new DateTime(null, new DateTimeZone('Asia/New Delhi'));
$DateTime->setTimezone(new DateTimeZone('Asia/Ne...
How to maximise the maximum size of POST in PHP
If your form sending much more POST request than the default size and you want to increase the size of POST then see the steps:-
Open the file php.ini
you can file the location of file from exicuting the PHP line below
<?php phpinfo(); ...
How to convert given seconds into day format using PHP
On converting the given time in seconds you have to follow the calculation in days and hours etc. Using PHP you can get the format by using the code below:-
Here I created the function ConvertToSec ($sec) as param:
function ConvertToSec($...
How to check if user's session is already started in PHP
If you want to know weather the session is already begin or not in PHP then, you can use of the syntax from PHP manual
see the example below
if (!isset($_SESSION)) session_start();
2.
And in case you are using PHP < 5.4 you hav...
How the see the body of a submit post using PHP
POST is a common mode of sending or passing the values from one page to another, But on getting what exact is inside the post PHP will offer you the code syntax.
Consider the example below:-
We will get the body part froma POST request or c...
How to get first n Characters from a given string using PHP
Hello Readers!
On a given string if you want to take out the first n number of characters from it then PHP offers you 'substr' to get the characters.
Consider an example below:-
Suppose I want to get the first 5 characters from string, $MySt...
Diffrence between print_r and echo in PHP
Although the syntax echo and print in php is almost do same function. On the performance based work there are some difference between then:-
Echo is much faster in performance than Print, Since it will not return any value.
On the basis of...
How to detect mobile device in website using PHP
If you want to know any mobile device is accessing your website, Then the easy way to detect device is to run a php code.
Lets see the code below :-
<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego)...
How to extract a number from given string using PHP
Using the PHP will give you several benefit to use code what you want.
And taking the number from any given string can be by diffrent - diffrent methods
lets se the example below:-
$myString = "I have 8 apples";
preg_match("|\d+|", $s, $myS...
How to make CSV File form array in PHP
Hello reader! If you have an array with the records and you want it to be download as CSV format. PHP has built in functions for making the format of CSV. Lets take the example below:-
header("Content-Type: text/csv");
header("Content-Disposi...
How to send SMS using PHP
Php offers you to make the integration of sms. We will discuss how to use php to send sms to any mobile number:-
Before we starts you need to have some any sms pack from mobile data companies but if you don't have you can make one you from twi...
How to compare two variable floats using PHP
While making the calculation with float variable one should really careful since there can be three cases, It can < or > or =. So lets see the example below and learn how to get the comparative.
$varOne = round(0.250, 3);
varTwo = roun...
How to use file_get_contents in PHP
Php offers you to send data in various ways like get, post. Using php you can also use file_get_contents
to send data using url. Lets see an example below:-
$information = array('http' => array(
'method' => 'POST',
'content' ...
How to make readable text from a pdf file in PHP
If you want to show a pdf file with the readable text from it on the page you can achieve it by seeing the code below
We will use a php library (pdfparser). This function will get the exact text as what you need
http://www.pdfparser.org/
...
How to make download a file strictly in PHP
On the execution of exe file you must need the property of header like Description, Type and Disposition
For making the strict/force download of a file in PHP you have to use the code below:-
<?php
$FileName = "http://abc.com/exa...
Best method for running all HTML pages act as PHP files
If you need something like all of your's html pages to be run like php files you can do the steps below:-
Step 1
Create a .htaccess file on your root.
Step 2
And add the line below
AddType application/x-httpd-php .html .htm
Or if...
How to make Email component in XAMPP
Hello Reader!
On using the PHP from your local host on XAMPP you can do several other things also
and we will learn how to configure mail from localhost using its sendmail package ,
The mail function is called sendmail, It's inbuild package ...
How to remove index.php from Codeigniter
Hello Reader! If you are new to working on Codeigniter Framework for PHP then you are very likely to encounter with the problem of index.php in url. Now we will see how to get resolve this error and then after you do not need to include index.php...
make your number to 2 decimal places round in PHP
Let's consider the example below using the function sprintf
$result = 3.146124;
echo sprintf("%.3f",$result);
output:
3.140
Alternatively, with printf:
$result_rounded = sprintf('%0.2f', $result);
Output
3.14
How to get the last key of an given array in PHP
Hello Reader!
Getting last the key index of any array PHP can be done on several ways as follows:-
Lets consider an example array $MyArray
$MyArray = array(
'one' => firstelement,
'two' => secondelement,
'three' =>...
How to get the file format/extension of file in PHP
Getting the file format or extension of any file can be done by various ways, In PHP you can use the one way as written bellow
$FileName = explode('.', $_FILES['photo']['name']);
$FileFormat = end($FileName);
Using the explode yo...
Combining two strings together in PHP
Combining of multiple using to add up one single can be achieve by various ways
In PHP you can either join then by using (.) Concatenate Operator or by using String Interpolation:
We'll do both of way here
Let's consider two stings
$o...
What are magic functions?
PHP have some magic methods that you can use in OOP (Object Oriented Programming). All the magic functions must be identified with twice underscores (__) prefix and they work as interceptors that will run when certain required conditions are met....
How to make a redirect html page using jQuery
Redirecting a web page will occur in the header part of the page.
In JQuery the page redirect have a code and it will go like this below
// similar behavior as clicking on a link
window.location.href = "http://findnerd.com";
As soon thi...