Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

How can I sort one dimensional arrays and data in PHP?

Basic one dimensional arrays $array = array(3, 5, 2, 8); Applicable sort functions: sort rsort asort arsort natsort natcasesort ksort krsort These all are the sorting method which will help us to sort an one dimensional array.

What is the difference between client-side and server-side programming?

There are n number of difference between client-side and server-side programming. The below code is split into two entirely separate parts, the server side and the client side. | ----------> ...

Where to find error logs in PHP

Hello Reader's! If you need to access your error log files in php then using Linux you can browser it as follows:- abhishek@roor /var $ sudo updatedb [sudo] password for abhishek: abhishek@roor /var $ sudo locate error_log ...

How to make a quick login page in Wordpress

Hello Reader's! If you are new to Wordpress and want to make a login custom page, then you can see an example below:- First you have to create a page on the root, name it login.php <?php /* * Template Name: Sign In */ if($_PO...

How to use PHP inside the Javascript

Hello Reader's!. If you having the JS file and you need to do some php coding inside the file, Then you can use the following coding standard:- <script type="text/javascript"> var jsVvariable = <?php echo json_encode($phpVariable); ?...

Use of $this->set() in Cakephp

Hello Readers , In cakephp development framework we will use $this->set() several times . The set() method is basically use to create a variable in our view file i.e. ctp file . If suppose we have an array $userprofile and we want to ...

How to replace any string using str_replace function in PHP

Hello Readers , While doing web development many times we stuck with the concept of str_replace . For understanding this, let's suppose we have one email template file stored in project directory and when we going to replace any string dyna...

How to create progress bar for uploading file using PHP

Hello Reader's!, If you are developing the html 5 based form and need to show the progress bar of file uploading then you can use the following code written in PHP and Javascript:- The PHP html file will be go like this:- <?php //get ...

How to make a cookie with no expire lifetime

Hello Reader's If you have writing the code that makes the cookies for valid lifetime then you just need to set big number for it's validity. As the example below PHP code:- Maximum value: 2147483647 setcookie("CookieName", "CookieValue", ...

How to check if a user has liked your Facebook page or not

Hello Reader's, If you are making the code for facebook page likes details and you want to know if the user has already liked your page or not, Then you can use the following library code for that :- <html> <head> <scrip...

Laravel 5.0 Including Sub View Into Another View

Many times we need some sections of HTML which need to be incorporated in many views and just to reduce redundancy we create separate views for it. An example to accomplish that is stated below:- Including other views in other view synt...

Laravel 5.0 Writing Static Query In Laravel

Many times we needs to write static query in Laravel. Some time due to the complexity of the query or sometime due to the MYSQL build in functions not supported in the Query Builder or in Eloquent in Laravel example LPAD. Thus at that time Larave...

PHP Getting Time Elapsed Per Last Comment

Passing date to the function and returning the time passed or elapsed when it was commented/posted. It is very useful when you have comment section in your website and you want to show how earlier comment was posted. /** * Creating the dat...

How to get Directory size using PHP

Hello Reader's!, If you are looking for a code that can give the directory size from a given path, Then you can use below library code for both Windows and Linux hosting:- If on a Windows Host: <? $filePath = 'c:/www/myfolder'; ...

Laravel 5.0 Giving Alias in routing

In route in laravel we can create alias for a url. Laravel provide us the facility for giving alias for an url. We can use this url alias any where in our view routes.php Route::get("admin/department/{id}", ['as' => 'department.edit', 'u...

What is the difference between '|' and '||' operators

Hello Reader's you might have seen the coding standard with the common syntax | and || is used. These are the syntax used for checking the conditions and sub conditions. The first | is called as bit wise Operator. It is used to make the conditio...

PHP :- Scraping Data From Youtube Video URL

You can also get the data i.e title, description, thumbnail_url, etc from the Youtube video url by using following script. Remember you need to put the YOUR_GOOGLE_DEVELOPMENT_KEY which you can generate by creating account in Google Developer Con...

How to enable Socket Transport SSL in PHP

Hello reader's If are using the Windows environment and developing the SSL based websites then you might have to enable the SSL for PHP for the first time. So to enable that you just need to perform the following tasks steps:- Step1: Renam...

How to get variable with same name in POST using PHP

Hello Reader's if have a html form with the variable of same name then you can get them indevisaly by POST Change the names of your inputs: <input name="name[]" value="Address" /> <input name="name[]" value="Number" /> <in...

How to sort an given array by it's any key index

Hello Reader's! if you have an given array on with you want to sort with any selected key index as show below:- Array ( [0] => Array ( [configuration_id] => 10 ...

How to extract website tittle using the given URL

Hello Reader's! If you having a set of given url's you need just the title of them, then you can use the PHP code below to extract title <?php function TitleURL($YourURL){ $str = file_get_contents($YourURL); if(strlen($str)>0)...

How to destroy user session automatically in PHP if he don't log out

Hello Reader's! If you have to destroy or unset the user's session automatic then the better way is to set with time dependency session_start(); if (!isset($_SESSION['EXPIRES']) || $_SESSION['EXPIRES'] < time()+1800) { session_destr...

How to integrate google reCAPTCHA in your html form?

To integrate reCAPTCHA in your HTML form, you need a public & secret key. You can get the both keys from this URL https://www.google.com/recaptcha/admin and it will look like Public Key: 9Madr_cSZZADgLy9zeFTEraGn9ogHhxuh_6pquJUHYyt ...

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 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 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...
1 10 14
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: