php5

How to use call_user_func_array with an object with a __construct method in PHP

How could I use call_func_array to create a new object with a __construct method (with some not optional arguments). Here's the code: $urls = array( 'view' => array( 'view/(\d+)', array('controller' => 'test', 'action' => 'view'), array(1 => 'id'), ), ); foreach ($urls as $name => $args) { $route = ca...

Is there an output difference between php 4 and 5?

I noticed the other day that a new script I wrote for php 5 began outputting html that was viewable before the php script had actually finished. Did this happen with 4? For instance, I have a long loop that echos something out with each iteration. The output was small in terms of kb, so I dont think it was lag due to the download speed....

cURL really slow

Does anybody know why could cURL under php5 be so damn slow to fail even at 45s timeout, downloading a few kb file on a speedO'light server? The code is here as requested (although I upped the timeouts even more for the script not to fail during execution and changed useragent to Mozilla/4.0 from initial Chrome): $ch = curl_init('http:...

Becoming Zend Certified Engineer

Hi, I have seen Zend certified engineers growing fast with upper hand over others. I am also planning to take this exam. I just wanted to know what areas of programming should I be more focused on when preparing for this exam. Any help from zend certified engineers will be greatly appreciated. EDIT Also suggest good resources about t...

Authentication methods for Zend Framework XML-RPC server

I have a Zend Framework application whose sole purpose is to serve as an XmlRpc / JSONRPC server. I've mostly followed the philosophy from this guide for my implementation method. I overrode my Bootstrap's run() method to run a Zend_XmlRpc_Server object and attach the API classes to it. I want to authenticate any XML-RPC method that ge...

PHP: PDF Generation

Hi, I am currently working on a website. Basically when a user searches for something, i should be able to generate the pdf for the each of the search result item. I know one option of fpdf. Is there something easier than fpdf or some service like if i send the url of my search result page, it sends back the generated pdf to me. What ...

cURL Download Progress in PHP not working ?

Hi, I am a PHP newbie and trying to add a progress-bar to an existing PHP script using the following method : $ch=curl_init() or die("ERROR|<b>Error:</b> cURL Error"); curl_setopt($ch, CURLOPT_URL, $c); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_FILE, $fp); //##############################################...

Can you rely on the order that regular expression syntax is interpreted?

(The background for this question is that I thought it would be fun to write something that parses wiki creole markup. Anyway the problem that I think I have a solution to is differentiating between // in a url and as opening/closing syntax for italic text) My question is slightly compound so I've tried to break it up under the headings...

PHP5 Frameworks: Autoloading and Opcode Caching

A number of frameworks utilize spl_autoload_register() for dynamically loading classes (i.e. controllers and models). There are a couple of posts on the issue of autoloading and opcode caching. One post in particular has a response by @cletus which references @Rasmus making a number of statements which prove to be unsavoury for those u...

Zend Cache Howto PHP

How can i do the followin tasks public function addToCache($id,$items) { // in zend cache } public function getFromCache($id) { // in zend cache } The first method should take an id and items which should be cached. The second method should just take an id of an cached object, and should return the content of the cache of that it...

CodeIgniter URLs

Hi, Any one of you who has worked on CI knows that it uses a segmental approach for the urls, eg.: index.php/controller/function/params Let's suppose I have put in place the following URL to submit the contact us form info: index.php/contact/submit_contact Now there is one thing that seems wrong. What if a bad guy sees the source ...

PHP: How to call function of a child class from parent class

Hi, How do i call a function of a child class from parent class? Consider this: class whale { function __construct() { // some code here } function myfunc() { // how do i call the "test" function of fish class here?? } } class fish extends whale { function __construct() { parent::construct(); } function...

will file_exist() php function cause high server load ?

i am trying to check if user uploaded his or her avatar image and i use file_exist() php function to check if the user avatar image exist or not will this cause any server load problem with massive traffic websites ? thanks ...

PHP: __set function behaviour different each time

This manages to create a new property on the object. But, can someone explain, with supporting links, why setAttrib behaves in two different ways? Why doesn't it cause a... wait for it... stack overflow!!?? class Test { public function setAttrib( $key, $value ) { echo "setAttrib\n"; // first time: calls $this->__set($key, $...

PHP Strict standards: Creating default object from empty value - How to Fix?

All, I have the following PHP5 code. $request = NULL; $request->{"header"}->{"sessionid"} = $_SESSION['testSession']; $request->{"header"}->{"type"} = "request"; It appears that line 2 and 3 are producing the following error: PHP Strict standards: Creating default object from empty value How can I fix this e...

php loop by date of the month

hi to all Provided the code stated below, the output are (see below). My question is why after 2009/11/01 it follow's by 2009/11/30 and 2009/12/30 instead of 2009/12/01. From 2009/06/01 ~ 2009/11/01 there is no problem. Any suggestion would greatly appreciated Thanks in advance Tirso output 2009/06/01 2009/07/01 2009/08/01 2009/09/0...

PHP: How to capture browser window screen with php?

Hi, First of all, i am not sure, if it is possible to capture browser window screen with php, then how to do it? If it is possible, the best will be to capture just the website content excluding browser parts such as menubar, toolbar, statusbar, etc. Thanks ...

MD5 File Hashing - match Delphi output with PHP md5_file function

I'm currently using this code for md5 hashing in Delphi 7: function MD5(const fileName : string) : string; var idmd5 : TIdHashMessageDigest5; fs : TFileStream; begin idmd5 := TIdHashMessageDigest5.Create; fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ; try result := idmd5.AsHex(idmd5.HashValue(fs)) ; ...

PHP: Getting reference ID

How do I get the PHP reference ID, as is possible with the var_dump function: // PHP 5.2.6 class Test {} $test1 = new Test; var_dump($test1); $test1b = $test1; var_dump($test1b); $test2 = new Test; var_dump($test2); Resulting in: object(Test)#1 (0) {} object(Test)#1 (0) {} object(Test)#2 (0) {} See, var_dump can tell which refer...

PHP Is there a PHP4 alternative to curl_multi_select

Hi there. Is there a PHP4 alternative to the function curl_multi_select() ...