Category : PHP


How to check file is exists or not in PHP?

If you need to check file is exixt or not on folder. Normally we require to check image is exist or not, video is exists or not etc. In this example i use file_exists() for determine file is available or not in given path. So if you also need check then follow bellow example: <strong>Example:</strong> <pre class="prettyprint lang-php"> if(file_exists('./upload/flower.jpg')){ print_r('Image is exist.'); }else{ print_r('Image is not exist.'); } </pre>

By Hardik Savani | April 26, 2016 | | 455 Viewer | Category : PHP
READ MORE

How to quick run any PHP Project?

If you want to run any php project directly without virtualhost then you can run easily. You must have install PHP only. Not only core php project but if you have question like how to run codeigniter project, how to run yii2 project, how to run symfony project, how to run zend framework project, how to run cakephp project, how to run drupal project etc, i mean you can run any project directly. You have to just fire bellow command on root directory. <strong>Run Command:</strong> <pre>php -S localhost:8000</pre> After this command you can access from bellow path: <strong>Run:</strong> <pre>http:.....

By Hardik Savani | April 24, 2016 | | 757 Viewer | Category : PHP
READ MORE

How to increase upload file size limit PHP in Ubuntu?

When i was working on my php project and i need to direct import mysql database in my phpmyadmin in Ubuntu 14.04 system, but my database size was 30MB, so i can't upload my database. that's why I need to change upload max file in php.ini. so try to find something how to change upload_max_filesize in php apache2. So if you also fetch problem like this then you can solve that issue just following example: <strong>Open php.ini file</strong> <pre> sudo gedit /etc/php5/apache2/php.ini </pre> After run above command you can open php.ini file and find bellow value and change value: <pre> upload_max_f.....

By Hardik Savani | April 20, 2016 | | 682 Viewer | Category : PHP
READ MORE

How to get php.ini file path?

You can get location path of php.ini file using php_ini_loaded_file() of PHP. Sometimes we require to get php.ini file path. So, if you need to get path of php confogration file then you can get following way: <strong>Example:</strong> <pre class="prettyprint lang-php"> print_r(php_ini_loaded_file()); </pre> You can find output something like bellow if you are use ubuntu system: <pre>/etc/php5/apache2/php.ini</pre>

By Hardik Savani | April 20, 2016 | | 920 Viewer | Category : PHP
READ MORE

How to check if string is URL or not in PHP?

Sometimes, we require to check the given argument or string is URL or not, as specially i did need to check image column is url or not like i give you example how to do this. If you also need to do this then you can use filter_var(). <strong>Example:</strong> <pre class="prettyprint lang-php"> if(filter_var($imagePath, FILTER_VALIDATE_URL) === FALSE){ print_r("Not valide URL"); }else{ print_r("valide URL"); } </pre>

By Hardik Savani | April 18, 2016 | | 550 Viewer | Category : PHP
READ MORE

Mediafire PHP file uploading and get link example

When i was working on my project i need to use mediafire API for uploading image and video, I did see this API is little hard to undestand but it is pretty easy to use also. In this post i want to share example how to get link of uploaded image or video. If you are new and you need to example for uploading example then it is very simple example that way you can undestand very well. I also see other example from google search but that was very difficult to undestand and use too. So ,first you should need to download mflib.php file for Mediafire API. so if you dan't have this file then you can.....

By Hardik Savani | April 15, 2016 | | 1634 Viewer | Category : PHP
READ MORE

How to set value as key in PHP array?

Sometimes, we work on big php or other framework projects and we need to change array value as array key at that time you can learn from this post. In this example you can do that without foreach loop. For example if you have all country array but that array have key like 1,2,3,4... etc and value is country. at that time you need to make array like country as key and value both that way you can store it on database table directly. We can do that using array_combine() of PHP array. array_combine() take two argument and both should be array. so, let's see exmple. <strong class="example">Examp.....

By Hardik Savani | April 8, 2016 | | 468 Viewer | Category : PHP
READ MORE

How to convert array key to lowercase in PHP?

Whenever you require to create all array key in lowercase then you can create that without using loop. you have to just use array_change_key_case(), array_change_key_case function take two argument one for array and second one for php function "CASE_LOWER". May be we need to do this when we are working on big projects and need to all key in small case. So, how to convert array values to lowercase using array_change_key_case(), see bellow example and learn how to work. <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> $myArray = ['Hey'=>'Hey','HELLO'=>'Hello','hi'=>'.....

By Hardik Savani | April 6, 2016 | | 519 Viewer | Category : PHP
READ MORE

Laravel 5 generate sitemap using roumen/sitemap package Example

In this post i want to githubve example of generate dynamic sitemap using "roumen/sitemap" package. sitemap is very usefull for SEO. you can submit your sitemap on google webmaster, bing webmaster etc that way you can increase website rank and web traffic. So, if you are working on Laravel framework then you can use "roumen/sitemap". this package will helps to generate dynamic sitemap of website. so it's very simple way to use and pretty interesting package. you can also add image on sitemap. this package is also provide to generate sitemap and store it on you folder etc. you can also see the .....

By Hardik Savani | April 6, 2016 | | 2976 Viewer | Category : PHP
READ MORE

How to convert array values to lowercase in PHP?

Whenever you require to create all array value in lowercase then you can create that without using loop. you have to just use array_map(), array_map function take two argument one for php function "strtolower" and second one for array. May be we need to do this when we are working on big projects and need to all values in small case. So, how to convert array values to lowercase using array_map(), see bellow example and learn how to work. <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> $myArray = ['1'=>'Hey','2'=>'Hello','3'=>'Hi','4'=>'GM']; $result = array_map('s.....

By Hardik Savani | April 5, 2016 | | 501 Viewer | Category : PHP
READ MORE

    Multi select autocomplete jquery example with code

    Multi select autocomplete jquery example with code

    Open Post

    How to install laravel framework on windows xampp server from scratch?

    How to install laravel framework on windows xampp server from scratch?

    Open Post

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Open Post

    How to use elasticsearch from scratch in laravel 5?

    How to use elasticsearch from scratch in laravel 5?

    Open Post

    Laravel 5 - Twitter API using thujohn/twitter composer package tutorial

    Laravel 5 - Twitter API using thujohn/twitter composer package tutorial

    Open Post

    PHP - import excel file into mysql database tutorial

    PHP - import excel file into mysql database tutorial

    Open Post