php


php - How to change mysql to mysqli?

The first thing to do would probably be to replace every mysql_* function call with its equivalent mysqli_*, at least if you are willing to use the procedural API -- which would be the easier way, co... Read More


php - What is SAPI and when would you use it?

SAPI stands for "Server API" (and API stands for "Application Programming Interface"). It is the mechanism that controls the interaction between the "outside world" and the PHP/Zend engine. So, you w... Read More


Is there a better PHP way for getting default value by key from array (dictionary)?

Time passes and PHP is evolving. PHP 7 now supports the null coalescing operator, ??: // Fetches the value of $_GET['user'] and returns 'nobody' // if it does not exist. $username = $_GET['user'] ??... Read More


php - How to check if not instance of some class in symfony2

Give them a common interface and then if (!$entity instanceof ShopEntity) or stay with if (!$entity instanceof User && !$entity instanceof Product && !$entity instanceof Order) I would avoid creatin... Read More


php - How to extract text from the PDF document?

Download the class.pdf2text.php @ https://pastebin.com/dvwySU1a or http://www.phpclasses.org/browse/file/31030.html (Registration required) Code: include('class.pdf2text.php'); $a = new PDF2Text(); $... Read More


php - SEO problems with multilanguage site

Here is your advice straight from Google. Google Webmaster Central Multilang howto... Read More


php - Favourite Kohana Tips & Features?

Generating Form::select() options from database result Kohana 3.1 and 3.0 $options = ORM::factory('model') ->order_by('title','ASC') ->find_all() ->as_array('id','title'); $select = Form::select(... Read More


class - Purpose of PHP constructors

A constructor is a function that is executed after the object has been initialized (its memory allocated, instance properties copied etc.). Its purpose is to put the object in a valid state. Frequent... Read More


php - Check whether an array is empty

There are two elements in array and this definitely doesn't mean that array is empty. As a quick workaround you can do following: $errors = array_filter($errors); if (!empty($errors)) { } array_fil... Read More


How can I check if a URL exists via PHP?

Here: $file = 'http://www.domain.com/somefile.jpg'; $file_headers = @get_headers($file); if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') { $exists = false; } else { $exists... Read More