Tag Archive

Unable to find the wrapper “https”

Published on October 29, 2011 By admin

Today I had to put a simple script on one of my hosting server where a “Facebook Login” button was available for login. However when I had to run it I encountered the following error: Warning: file_get_contents() [function.file-get-contents]: Unable to find the wrapper “https” – did you forget to enable it when you configured PHP? [...]

$_FILES limitation when uploading files in PHP

Published on October 14, 2011 By admin

Along with the “upload_max_filesize” when uploading files with PHP there is another parameter named “max_file_uploads” witch prevent uploading more files that the value of this parameter. Default size of this parameter is 20 and is should be enough for more apps then I can count but today I had to repair a bug in a [...]

PHP: trim spaces in the middle of a string

Published on February 14, 2011 By admin

When you let users input text in a textfield or input box iti is always a good ideea to use trim function to remove spaces form the begining or the end of the string. Today I needed a function to trim spaces from the middle of a string and replace with a single space. /* [...]

Substract 1 hour from current date in PHP

Published on December 8, 2010 By admin

This 3 lines will give you the current date minus 1 hour: $date = date("d-m-Y H:i"); $newdate = strtotime ( ‘-1 hour’ , strtotime ( $date ) ) ; $newdateStr = date (‘d-m-Y H:i’ , $newdate );

How to display all Global variables in PHP

Published on August 25, 2010 By admin

Sometimes when debugging an application you need to see all global variables. In PHP there is an easy way: $defined_vars = get_defined_vars(); print_r($defined_vars);

New Line in PHP

Published on March 31, 2010 By admin

Printing a new line witch is visible in a web page is made like this: echo(‘line 1′.‘\n‘.‘line 2′);   the code above will print line 1 on a line and line 2 on a new line. Now if you have to generate a CSV file  <br/> wil not work  you have to use  \n like [...]

Neural Networks in PHP

Published on March 9, 2010 By admin

Browsing phpclasses.org I had found a very interesting article Neural Networks in PHP . For anyone who dont know yet “Neural networks allow emulating the behavior of a human brain in software applications.” In this article you can read how to implement Neural Mesh to develop Neural Network applications in PHP. (Neural Networks in PHP) [...]

Format PHP Date to MySQL Format

Published on May 17, 2008 By admin

When you insert or update a date in a mysql Table you have to remember that Mysql have 3 types of date DATETIME         ( default format 0000-00-00 00:00:00 ) DATE                ( default format 0000-00-00 ) TIMESTAMP      ( default format 0000-00-00 00:00:00 ) PHP code:       DATE ->  $mysqldate = date( ‘Y-m-d’ );       DATETIME, TSTAMP [...]