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

Cannot send session cookie - headers already sent

Welcome to FindNerd. We sometime get the error- can not send session cookie - headers already sent while we use the session. When we start the start the session with the help of session_start, it means we are ready to use the session. To avo...

random_int and random_bytes functions PHP

Welcome to Findnerd. There are two new functions named random_int and random_bytes which are introduced in PHP7. You can generate the cryptographically secure integers and strings with these functions. random_int takes two parameters, one is...

Remove duplicate Array from Multidimensional Array with the key defined

Here we will learn that how we can remove duplicate Array from multidimensional Array according to the key in the Array. Lets look at the example below :- Here I have initialized one multidimensional Array, now I would like to remove thos...

Enhancement in define function php

Welcome to Findnerd. We all knows and have used the define function in PHP but it is improved little bit. Now we can assign the array to the constant using define function. Please have a look. define('TAX_RANGE',[9.25,10.25]); In above ...

Closure::call()

Welcome to Findnerd. Today we are going to disccus two new features introduces in PHP7 that are closure::call. You can bind the outer function in class. It is also known as temporarily binding an object scope to a closure and invoking it. Please ...

Change method visibility with traits

Welcome to Findnerd. We have discussed the traits in previous blogs. You can check the other blogs for basic understanding. We can use the methods including in traits and can perform the other operations as well. You can change the methods visib...

How to convert Unix time stamp into date time using PHP

Hello Reader's! If you have the time stamp in unix time and you need to convert them into Date time format Then you can use the diffrent ways of doing this in PHP Let's say the example below:- $timestamp=1455070324; echo gmdate("Y-m-d\TH...

Multiple Traits

Welcome to Findnerd. Today we are going to discuss the multiple traits in php. Trait is also a classes, only difference is that we can not create object for traits. We can only use the methods which are implemented in it via use keyword. Please c...

Traits vs Interfaces

Welcome to Findnerd. Today we are going to discuss the difference between interface and traits. Interface is a contruct between program and programmer. You can say like this, it is blueprint for the classes. Interface has abstact methods which m...

Script for email send with multiple attachments using PHP?

We can send mail by Using mail() function.This is a PHP predefined function for sending mail. Also we can send multiple attachment at the same time using php mail function and using php code for multiple files. For sending multiple atta...

Resolve maximum allocation time exceeds error in PHP?

In PHP, many times we found the error i.e. "maximum allocation time exceeds". For resolving these errors we use php.ini file or we can resolve it buy using our .htaccess file. 1. Using php.ini file For this we have to increase the max...

Final class in PHP?

Final class in PHP is a class that can not be inherited. or we can say that it can not be extended . It basically protect the methods of class that is to be overriden by the other child classes present there. For declaring a class as final,...

How can change the URL of admin in Magento?

For changing the url of admin from our existing magento store there are two methods we have: Method 1- First Go to app/etc/local.xml file , open this file with an editor .Now find for the admin node where you have to change the frontName...

Null coalescing operator and spaceship operator

Welcome to Findnerd. Today we are going to discuss the Null coalescing operator and spaceship operator which are added in PHP7. Null coalescing operator is enchanced version of ternary operator. You should be familar with the ternary operator. W...

Magento ORM process?

ORM means "Object Relational Mapping." it is a technique that we basically used to convert types of data to an Objects Also as converting any objects to data. Magento, ORM is stands as Model (which is based on Zend Framework Zend_Db_Ad...

Return type in PHP

Welcome to Findnerd. Today we are going to discuss the return types in php which is improved in PHP7. In php 7 you can set the data type for the return value of the function. You need to set the declare(strict_types=1) in the file top. <?p...

Scalar types in php

Welcome to Findnerd. Today we are going to dicuss the strict typing mode and weak typing mode which is introduced in PHP7. strict typing mode is not activated by default. You need to activate it via declare like this declare(strict_type=1); ...

PHP Filters

Welcome to Findnerd. We are going to discuss PHP filtering today. We all knows version by version PHP introducing new ways of coding and many improvements. PHP has launched the PHP7. There are many new features added as well as did many improve...

Creating Closure function in php

In this tutorial we will learn about the closure function in php. Here we will see simple closure using an anonymous function. Example 1: // Create a user $user = "xyz"; // Create a Closure $invoke = function() use($user) { ...

Some functions that are removed in PHP7

Here we will see some of the functions listed below that are removed in PHP7. 1- ASP-style tags ( <%, <%= and %> ), is removed. 2- Script tags "<"script language='php' ">" Note: always use "<"?php ?">". 3-Split func...

Generate a random and unique password

Hello readers, today we discuss about "Generate a random, unique password or alphanumeric string" using Php function. function random_string($len) { $key = ''; $keys = array_merge(range(0, 9)); for ($i = 0; $i < $len; $i++)...

How to get the vedio views from youtube using API in PHP

Hello Reader's If you want o get the total counts of a views on youtube video by api, then you can use the following php code. <?php $video_ID = 'your-video-ID'; //set the id from url $JSON = file_get_contents("https://gdata.youtube.com/f...

Magento indexing issue

Sometime we face issues in reindexing like "Some problem with reindexing process" error, there are many reasons for it - 1) maximum execution of script 2) number of products in database and store view 3) locked files of previous process ...

Anonymous function in php

Anonymous functions, is a function that allows the creation of a function without any specific name. We can use it as follows: 1-Assign it to a variable, then call it later using the variable's name. 2-We can store an array of different ano...

Outer joins in database query

Joins in database, We can easily determine the meaning of joins very easily. In database we use the concept of joining in tables to fetch the data combination. There are different type of methods of joining two or more than two tables in databas...

How to pass multiple optional parameters using Laravel 4.x

As we all know that routes plays an important role in any MVC framework. In Laravel we will define our routes in routes.php. Using Laravel 4.x we have the option to pass multiple optional parameters using Laravel 4.x. By using example it can b...

Laravel join with 3 Tables

As we all know that when we are working on the big project then there is a need of join 2-3 table to get the result. We can easily understand that by using example of joining 3 table. Example: $shares = DB::table('shares') ->join...

How to autoload Guzzle in Laravel 4

It becomes easier with Guzzle, which is a PHP HTTP, to send HTTP requests. Moreover, one can easily perform the task of integrating with web services. Guzzle enables to send both synchronous and asynchronous requests. Guzzle using Laravel 4.x:...

How to remove duplicate key values in a Multidimensional array using PHP

Hello Reader's If you have an multidimensional array which you want to sort. Then PHP offers you many ways to do it. Let's see the easiest way to achieve it:- Array ( [0] => Array ( [0] => dave [1] => jones...

How to convert string into an array using PHP

Hello Reader's! If you're having a problem to convert a string into an array then you can use the html entity in php. Let's see the example below:- & then be sure to use html_entity_decode // Input string // $input = 'pg_id=2_parent_...

ImageMagick basic

ImageMagick is a free available collection of programs for image manipulations. You can essily play with 200 different extensions images with ImageMagick. You can install it with the help of simple commands on unbuntu. sudo apt-get install ...

Best way to send array with URL using PHP

Hello Reader's! If you want to send an array as a Param with the url then you can use the serialize and deserialize option from PHP Lets see the example below:- <?php $array["a"] = "Thusitha"; $array["b"] = "Sumanadasa"; $array["c"] = "L...

FPDF class php

FPDF is a library to handle the pdf files. FPDF stands for free pdf. It provides high level functions to generate the pdfs. FPDF does not require any support. It is pure php library. You can download the library from this website http://www.fpd...

PHP date_add() Function ?

The date_add() function is mainly used for adding some days, months, years, hours, minutes, and seconds to a date. Syntax of date_add() date_add(object,interval); you can take belloe example for better understanding: <?php //her...

How to use strtotime() Function in PHP ?

The strtotime() function parses an English textual datetime into a Unix timestamps (the number of seconds since January 1 1970 00:00:00 GMT). Syntax of strtotime() Function strtotime(time,now); you can see belloe example: <?ph...

How to send a mail using php ?

In this blog we will see how to send a "Simple Text Email" ? The Php mail( ) function is used to send Emails in PHP. There are three main parameters we have to pass for sending a simple email and one is optional parameter. There 3 param...

How to use date() Function in php ?

The date() function formats a local date and time, and returns the formatted date string. Basically uses of The date() function formats a local date and time. The date() function returns the formatted date string. syntex of date () funct...

How to check image extension before uploading a image ?

There are many way to check image extension before uploading. But "in_array()" function it is very useful way to check image extension when you are uploading a lots of extensions to validate. if the "in_array()" function fails, this mean c...

How to ignore HTML content with tags using PHP

Hello Reader's If you want to make an function which truncate all the html contents and ignore them then you can uset the Sren Lvborg printTruncated function making it UTF-8 (Needs mbstring) function. It's example as below:- /* Truncate HTML, ...

How to send email using AJAX request?

Hello Reader's If you need to make ajax request that send the email in backgournd page then you can use the code below:- $('#submit').click(function() //specify your selector of form { $.ajax({ url: sendemail.php, // your action...

What is shuffle in PHP

Hello Reader's, If you want to know about shuffle function in PHP then this article is helpful for you. Lets say you want to generate 100 numbers on a random basis, a good way would be to generate an array with the numbers in order, then shuffle...

How to give output an image using PHP

Hello Reader's if you want to give output as an image then you can use the code below:- You can use finfo (PHP 5.3+) to get the right MIME type. $filePath = 'yourfile.ext'; $finfo = finfo_open(FILEINFO_MIME_TYPE); $contentType = finfo_fil...

How to use fgets in PHP

Hello Reader's If you need to read a given file line by line then PHP will offer you to use Fgets to do. Lets see it's example as below:- $handle = fopen("yourfile.txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) ...

Difference between array_key_exits and isset in array

Hello Reader we almost have header about array_key_exits and isset but you need to know the diffrence between them. Lets take an example below:- array_key_exists will only work when your key have an element and doesnt matter it is null, but is...

How to send an email using Gmail SMTP with PHP

Hello Reader's! If you want send an email with secure SMTP with you should choose google gmail smpt. And the code liberary is here:- $mail = new PHPMailer(); // create a new object $mail->IsSMTP(); // enable SMTP $mail->SMT...

Truncate a given sting just after a fixed count of chars using PHP

Hello Reader's! if you want to short a given string on fixed number of chars then php offers you many ways. Below is one of them, you can use this code for the same. Lets see the example below:- $sting_given = "1234567890134667896abcdtiABCD...

How you can stop the re submit of form using Unique id of form

Hello Reader's!, If you need a nice method to stop the form from again and again submit via refresh, PHP offers you many ways like header redriect or unset the $_POST but a pretty way is to implement a unique ID into the post and cache it in the...

How to unzip a file uisng PHP

Hello Reader's!, If you have a zip file and you need to execute unzip the file using PHP, Then you can use the PHP liberary code below:- // Lets say you have zip file in the same folder of php file. $file = 'file.zip'; // get the absolute ...

How to convert a given XML into PHP array

Hello Reader's!, If you are developing the website that takes input in XML and you want it to convert in PHP, Then you have to use some of the library extensions to do so. Let suppose you have the XML as given below:- <tag1Version="1.0"&...

How to send and email without SMTP using PHP

Hello Reader's! If you are new to php and need to send emails then PHP offers you many ways. But you can use the PHP code below, It's simple and does not use yourSMTP. Create a PHP page sentemail.php <?php if(isset($_POST['s...
1 26 44
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: