Download and install right version of ghostscript. In my case my PHP was x86 architecture, so I download Ghostscript 9.14 for Windows (32 bit).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Check if a directory is empty (a directory with just '.svn' or '.git' is empty) | |
| * | |
| * @param string $dirname | |
| * @return bool | |
| */ | |
| function dir_is_empty($dirname) | |
| { | |
| if (!is_dir($dirname)) return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class myClass { | |
| public $param1 = 'a'; | |
| public $param2 = 'b'; | |
| public function __construct($param1 = NULL, $param2 = NULL) { | |
| if ($param1 == NULL && $param2 == NULL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Approach 1 | |
| <?php | |
| class A | |
| { | |
| function __construct() | |
| { | |
| $a = func_get_args(); | |
| $i = func_num_args(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is shamelessly copied from http://stackoverflow.com/questions/263743/how-to-get-cursor-position-in-textarea#answer-3373056 | |
| function getInputSelection(el) { | |
| var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; | |
| if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { | |
| start = el.selectionStart; | |
| end = el.selectionEnd; | |
| } | |
| else { | |
| range = document.selection.createRange(); | |
| if (range && range.parentElement() == el) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function __autoload($class) | |
| { | |
| if (strpos($class, 'CI_') !== 0) | |
| { | |
| if (file_exists($file = APPPATH . 'core/' . $class . EXT)) | |
| { | |
| include $file; | |
| } | |
| elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| defined('BASEPATH') OR exit('No direct script access allowed'); | |
| $active_group = 'default'; | |
| $query_builder = TRUE; | |
| // FOR SQLITE | |
| $db['default'] = array( | |
| 'dsn' => 'sqlite:[path-to-database-file]', | |
| 'hostname' => 'localhost', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* Simple sample USSD registration application | |
| * USSD gateway that is being used is Africa's Talking USSD gateway | |
| */ | |
| // Print the response as plain text so that the gateway can read it | |
| header('Content-type: text/plain'); | |
| /* local db configuration */ | |
| $dsn = 'mysql:dbname=dbname;host=127.0.0.1;'; //database name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Ref : http://php.net/manual/en/function.ftp-put.php | |
| $name = "test.txt"; | |
| $filename = "/home/mine/Desktop/test.txt"; | |
| //-- Code to Transfer File on Server Dt: 06-03-2008 by Aditya Bhatt --// | |
| //-- Connection Settings | |
| $ftp_server = "server_url_here"; // Address of FTP server. | |
| $ftp_user_name = "username_here"; // Username |