I’ve never seen code like this: Is it the same as new className() ? EDIT If the class is inheritant,which class does it point to? Answer self points to the class in which it is written. So, if your getInstance method is in a class name MyClass, the following line : Will do the same as : Edit : a
Tag: php
generate a unique hash value which can be used as primary key in mysql thru php
I am using auto increment value for the inserts in my table. But is there any other way to generate a unique value (which is small enough and not GUID or UUID) in php to insert as primary key in mysql? Basically I want to get the value that is used as PK, but using auto increment I guess I
How to declare abstract method in non-abstract class in PHP?
reports: PHP Fatal error: Class absclass contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (absclass::fuc) I want to know what it means by implement the remaining methods,how? Answer I presume that remaining methods actually refers to the abstract methods yo…
Error logging php – error_reporting(0) not having desired effect
I’ve got a pretty simple page which fetches a url and parse some data. I have built into my page some error handling in the event that the response is a 404 error. However, I can’t seem to stop php from spitting out the following errors Warning: file_get_contents(http://url-to-retrieve.com/123.htm…
How do I add static pages to WordPress?
How do I add my own static HTML pages to WordPress? For example, let’s say I have a page, products.html, how would I add it to WordPress (any menu, etc.) and once added, how do I visit them, because WordPress had a typical URL structure? Answer The static page functionality of WordPress is called, cleve…
Dealing with eacute and other special characters using Oracle, PHP and Oci8
Hi I am trying to store names into an Oracle database and fetch them back using PHP and oci8. However, if I insert the é directly into the Oracle database and use oci8 to fetch it back I just receive an e Do I have to encode all special characters (including é) into html entities (ie: é) before i…
Is there an online code coloring service? [closed]
I would like to know if there is an online service where we paste the code and it generates back the colored HTML source code for that code. It could be PHP, HTML, CSS, JavaScript, C, and Java. The …
PHP Fatal error: Using $this when not in object context
I’ve got a problem: I’m writing a new WebApp without a Framework. In my index.php I’m using: require_once(‘load.php’); And in load.php I’m using require_once(‘class.php’); to load my class.php. In my class.php I’ve got this error: Fatal error: Using $this …
Converting to date in PHP from yyyymmdd format
I have dates in the following format (yyyymmdd, 18751104, 19140722)… what’s the easiest way to convert it to date()…. or is using mktime() and substrings my best option…?
Is there some limit on a size of a file when causing a download with PHP?
Trying to force-download file with PHP using usual: And it does successfully for files somewhere below 32 mb. For bigger ones it just returns zeroed file. Obviously there’s some kind of limit, but what sets it? Using Apache 2.2.11 and PHP 5.3.0. Answer I eventually stumbled on this post: http://w-shadow…