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

328 questions
1021
votes
29 answers

How do I use PHP to get the current year?

I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated. How would I make the year update automatically with PHP 4 or PHP 5?
JD Graffam
  • 10,315
  • 2
  • 16
  • 6
47
votes
3 answers

Generate preview image from Video file?

Is there a way in PHP given a video file (.mov, .mp4) to generate a thumbnail image preview?
JD Isaacks
  • 51,154
  • 89
  • 267
  • 413
21
votes
2 answers

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…
Steve H
  • 898
  • 7
  • 21
14
votes
6 answers

Your experience Moving PHP 4 to PHP 5

We have to move around 50+ Applications (small / large) to PHP 5.3 (from PHP 4.1). Does some has any experience with such an task? Time needed Tools Best setup for environment (Servers/Test?) Does it make sense to move first to PHP 5.2? Is there…
opHASnoNAME
  • 18,735
  • 24
  • 93
  • 138
14
votes
6 answers

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;…
JD Isaacks
  • 51,154
  • 89
  • 267
  • 413
13
votes
8 answers

Get date of Monday in current week in PHP 4

I need to find the date of Monday in the current week. How can I do this in PHP 4?
Ben Jones
  • 139
  • 1
  • 1
  • 3
8
votes
3 answers

When and how to use Constants in PHP?

I'm currently programming a website (in PHP4). I plan to save values, which do not change during runtime, in constants. Those are for example the version number of login-data for the database. Question 1: are there any (security relevant) problems…
R_User
  • 9,332
  • 22
  • 68
  • 115
8
votes
2 answers

How do I determine if an array is empty in PHP?

I want to check that an array has no values or that the values in the array are empty. Can someone explain how to do this?
n92
  • 6,776
  • 26
  • 87
  • 127
8
votes
1 answer

Difference between old-style and new-style PHP constructors

Could someone tell me how the "old-style" object constructor is different from the "new-style" constructor? I'm learning PHP OOP, and I want to know when I'm reading old syntax vs new syntax, and better understand how OOP has changed in PHP over…
White Lotus
  • 333
  • 6
  • 14
8
votes
1 answer

PHP 4 won't take PHP.ini changes after Apache restart

We have a very old PHP application that needs PHP 4 to run. We're decommissioning the old server and so I've built PHP 4 on the new server (Ubuntu 13.04 32 bit). When I did ./configure I made sure to do --with-config-file-path=/etc/php4/php.ini. …
nwalke
  • 3,042
  • 3
  • 29
  • 59
7
votes
4 answers

How to use nuSOAP for messages with multiple namespaces

I'm trying to access a WebService using nuSOAP (because I'm bound to PHP4 here) that uses more than 1 namespace in a message. Is that possible? An example request message would look like this:
wilth
  • 695
  • 2
  • 8
  • 19
7
votes
3 answers

php output with sleep()

I'm trying to run a loop every second for 25 seconds basically. for($i = 0; $i <= 25; $i += 1){ echo $i; sleep(1) } The thing is it doesn't output until it's fully done, so after the loop continues 25 times. Is there a way to do this so…
dzm
  • 20,376
  • 41
  • 127
  • 215
7
votes
4 answers

PHP4: Send XML over HTTPS/POST via cURL?

I wrote a class/function to send xml over https via PHP4/cURL, just wondering if this is the correct approach, or if there's a better one. Note that PHP5 is not an option at present. /** * Send XML via http(s) post * * curl --header…
starmonkey
  • 3,087
  • 2
  • 18
  • 15
7
votes
2 answers

Using mail() to send an attachment AND text/html in an email in PHP4

To make life difficult, the client I'm working for is using a really large yet old system which runs on PHP4.0 and they're not wanting any additional libraries added. I'm trying to send out an email through PHP with both an attachment and…
James Donnelly
  • 117,312
  • 30
  • 193
  • 198
5
votes
3 answers

Merging two arrays, overwriting first array with second one

I would like to merge two arrays containing a list of files plus their revision in brackets. For example: Fist array: 0 => A[1], 1 => B[2], 2 => C[2], 3 => D[2] Second one, 0 => B[3], 1 => C[4], 2 => E[4], 3 => F[2], 4 => G[2] Like I said, I would…
Pierre-Olivier
  • 3,046
  • 16
  • 36
1
2 3
21 22