Questions tagged [php4]

For issues relating to development using PHP, version 4.

PHP is a widely-used, general-purpose scripting language designed specifically for web development, though it has since been extended to other applications too. PHP is the most popular language for web development, powering over 20 million websites.

Useful Third-party Code and Tools

In addition to the vast functionality provided in the PHP Core and through PEAR and PECL, there are a number of noteworthy 3rd party contributions to the PHP world, some of which are listed below.

Related tags

323 questions
2
votes
2 answers

PHP4 HTTP Post without cURL

I have the following code that works on PHP5 to send a HTTP POST without using cURL. I would like this to work on PHP 4.3.0 and above: $opts = array('http' => array( 'method' => 'POST', 'header' => "Content-type:…
Luke
  • 6,195
  • 11
  • 57
  • 85
2
votes
4 answers

Should there be something like 'bytelen' (along with 'strlen')?

In my opinion the 'strlen' function should only return the number of characters in a string. Nothing else. And it does, whether it counts ASCII characters or Unicode characters. A character is a character, pointing to a given position on an ASCII…
user289475
2
votes
1 answer

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 ) { …
JD Isaacks
  • 56,088
  • 93
  • 276
  • 422
2
votes
2 answers

building a 'simple' php url proxy

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…
Bachalo
  • 6,965
  • 27
  • 95
  • 189
2
votes
1 answer

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…
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
2
votes
2 answers

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…
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
2
votes
0 answers

How to decode a xmlrpc binary object in php?

I want to transfer some binary data over xmlrpc, from python on one end to php on the other end. The details are explained in this python example, especially the code on the server side handling the binary data: from SimpleXMLRPCServer import…
Alex
  • 41,580
  • 88
  • 260
  • 469
2
votes
1 answer

PHP4 to PHP5 migration character encoding. latin1 vs utf8

I recently migrated from a PHP 4.3.9 / MySQL 4.1.22 setup to a PHP 5.3.3 / MySQL 5.1.69 setup. I seem to have a problem with character encoding. My database collation is latin1_swedish_ci. Whenever I enter new data in my table through my PHP…
Tom S.
  • 51
  • 5
2
votes
1 answer

git-p4 and pulling from other repos

I have a laptop and a desktop, for which I'm trying to learn to use git to manage my work against a perforce repository. I'm using git-p4 successfully on the desktop, and can use it successfully on the laptop as well, in isolation. However, one of…
user196097
2
votes
1 answer

unable to sort date using usort

I have user defined function sort which sorts by date. It works fine for the same year and does not work when the year changes. This an example of the dates that is sorted by the function: 01/02/2013 01/03/2013 12/12/2012 function…
Micheal
  • 2,272
  • 10
  • 49
  • 93
2
votes
2 answers

set-cookie expiration in seconds

Does the html header Set-Cookie function accept expiration in seconds? header( "Set-Cookie:". $cookieName."=".$sessId."; expires=".$expireSeconds."; sessionID=".$sessId.";path=".$path."; domain=".$domain."; httponly; secure); $expireSeconds =…
Micheal
  • 2,272
  • 10
  • 49
  • 93
2
votes
3 answers

Is there a Dependency Injection framework for PHP4?

I'm stuck on a PHP 4 server, and I would like to start moving an old legacy project to modern Design Patterns, including Dependency Injection. Are there any dependency injection frameworks that will work with PHP 4?
Adam Ness
  • 6,224
  • 4
  • 27
  • 39
2
votes
2 answers

php 4 to 5 porting question on how to reset a class

Someone wrote the following php4 code which I now am trying to port to php5: the class is Foo (name changed to protect the guilty). In one of the methods, we'll call it save() the class apparently is reset like this: $this = new…
Maarten
  • 4,643
  • 7
  • 37
  • 51
2
votes
2 answers

SVG to JPEG via PHP4

I am currently struggling with a side project I hope you can help me with. I am trying to convert SVG images to JPEG with PHP4. Originally I tried to interface java with php via the php_java.dll and jar that comes with PHP 4.2.2 but while I never…
graham.reeds
  • 16,230
  • 17
  • 74
  • 137
2
votes
1 answer

how to properly manage triggered errors in PHP4

m maintaining a project, that has to be compatible through PHP 4.X to 5.2. The project as several errors wich are not very well handled. What I want to do is redirect user to a "nice" error page, and log the error in the database. In order to keep…
monsieur_h
  • 1,360
  • 1
  • 10
  • 20