php4

Is there a call_user_func() equivalent to create a new class instance?

How can I create a class with a given array of arguments to be sent to the constructor? Something along the lines of: class a { var $args = false; function a() {$this->args = func_get_args();} } $a = call_user_func_array('new a',array(1,2,3)); print_r($a->args); Ideally this needs to work, without modification to the class, i...

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....

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...

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 ...

How could I parse gettext .mo files in PHP4 without relying on setlocale/locales at all?

I made a couple related threads but this is the one direct question that I'm seeking the answer for. My framework will use Zend_Translate if the php version is 5, otherwise I have to mimic the functionality for 4. It seems that pretty much every implementation of gettext relies on setlocale or locales, I know there's a LOT of inconsiste...

PHP Is there a PHP4 alternative to curl_multi_select

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

How to use get_cfg_var() in a cakePHP app ?

I have a cakePHP app with my DB servers configured in the app/config/ database.php file. However, I need to use the get_cfg_var ('mysql.default_host') to get the host name because the client does not want the name hardcoded. I would appreciate a quick response regarding where the changes need to be made. Thanks ...

Yet another 'Call to a member function on a non-object' problem

I have a html page that calls a php object to get some data back from the database. It works fine, but the script was getting unwieldy so I decided to break some of it out into a bunch of functions. So I have the following files: // htdocs/map.php <?php include("config.php"); include("rmap.php"); $id = 1; $gamenumber =...

Can I use PHP4 to interact with an SVN repository without a working copy?

I would like to perform SVN operations on an SVN repository (over HTTP, if it matters) without requiring a working copy. Basically, here are the things I want to do: Check if a directory exists remotely. If the directory does not exist, create it Check if a file exists in the repository if the file does not exist, create a new fil...

PHP: Generate preview image from Video file?

Is there a way in PHP given a video file (.mov, .mp4) to generate a thumbnail image preview? Thanks. ...

Using static properties in PHP >= 4.3.0?

Disclaimer: Yes, I am forced to support PHP 4.3.0. I know it's dead. No I can't upgrade it, because I'm dealing with multiple servers some of which I don't have su access. Well, since I can't use self:: since it's PHP5 specific, how should I go about implementing statics in a PHP4 class? So far from my research it seems that I can...

Is mb_strlen a suitable replacement for iconv_strlen

That is, if I'm coding something entirely in PHP4? Or perhaps I should use a custom function or class/extension instead to count the number of characters in a multibyte string? Only difference I can spot is that mb_string strips out bad sequences, while iconv_strlen doesn't. ...

Is it a good idea to internally invoke the constructor in a static method?

Let's say for example I had a localised date class where the normal usage was to create an object. $d = new Date(mktime(), 'MM-DD-YYYY', array('locale' => 'es')); Now, what if I didn't want to always create a new object explicitly, but instead wanted something more along the lines of... <p>The date is <?php echo Date::formatDate( mk...

POST to different page depending on SELECTvalue?

I have a form, depending on the selected value of my <select> box I would like to send to a different page. I do not know the best way to do this, but I am thinking that maybe the best way is to have an intermediate page to always post to, then have the intermediate page check the value sent from the <select> box and forward the POST va...

Why PHP 4.4.9 throws 'Parse error: syntax error, unexpected T_STATIC'?

I just realized the professor Google is unable to present a specific page where I can find out, when static keyword added to PHP 4. Though following the change log for php 4 I can see that it was available since Version 4.0.6 (or before) but why does it throws: Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION ...

php HTTP_REFERER header, how to turn off or leave blank

Hi I'm using the following simple PHP proxy script but am getting a sporadic message at the destination site. I'm thinking that perhaps it may have something to do with the HTTP_REFERER header, although I'm not explicitly defining it. Can anyone tell me how to explicitly turn off or leave the HTTP_REFERER header blank? Thanks in advan...

building a 'simple' php url proxy

Hi I need to implement a simple PHP proxy in a web application I am building (Its flash based and the destination service provider doesn't allow edits to their crossdomain.xml file) Can any php gurus offer advice on the following 2 options? Also, I think, but am not sure, that I need to include some header info as well. Thanks for any ...

PHP: Define function with variable parameter count?

Is there a way to define a function in PHP that lets you define a variable amount of parameters? in the language I am more familiar with it is like so: function myFunction(...rest){ /* rest == array of params */ return rest.length; } myFunction("foo","bar"); // returns 2; Thanks! ...

PHP: Problem merging arrays

OK I have this function (I got as the answer to this question) that merges an array like so: Functions function readArray( $arr, $k, $default = 0 ) { return isset( $arr[$k] ) ? $arr[$k] : $default ; } function merge( $arr1, $arr2 ) { $result = array() ; foreach( $arr1 as $k => $v ) { if( is_numeric( $v ) ) { ...

Filter/parse/modify emails and hrefs from html content in PHP4

I'm not validating emails. What I want to do is find (and then change) 3 separate types of "email" content in a (html) string: a plain email: eg [email protected] a mailto href: eg <a href="mailto:[email protected]">[email protected]</a> an aliased href: eg <a href="mailto:[email protected]">user's email</a> I'm then going to transform each example ...