What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP
<?php
$class_name = 'SomeClassName';
$object = new $class_name;
?>
This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement.
Problems that...
I'm kind of interested in getting some feedback about this technique I picked up from somewhere.
I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit over the top for this sort of...
PHP5 has a "magic method" __call()that can be defined on any class that is invoked when an undefined method is called -- it is roughly equivalent to Ruby's method_missing or Perl's AUTOLOAD. Is it possible to do something like this in older versions of PHP?
...
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?
...
I am trying to make this feature available, maybe in an apache .htaccess file.
...
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 "Content-Type: text/xml" --data "<?xml version="1.0"?>...." http://www.foo.com/
*
*/
function sendX...
Hi, I recently moved from a windows based development environment to an ubuntu one. I need to have both PHP4 and PHP5 available (PHP4 is a company requirement, so not much I can decide about it). My problem is that I can't install PHP4, as it's not available as a package an it seems that the only way to get it would be to compile it. Can...
I'm in search of the web hosting space, and got to know the PHP version is 4.3 and MySQL Version 4.1
But i developed my application in MySQL version 5.x and PHP version 5.x
Can anyone give me the differences in versions ?
what all i cannot access now ?
Thanks...
...
I know that it's more performant to use '' delimited strings rather than ""...
but I was wondering if there's any performance improvemente doing this
$a = array( 'table' => 'myTable', 'order' => 'myOrder' );
$table = $a['table']
instead of
$a = array( table => 'myTable', order => 'myOrder' );
$table = $a[table]
I guess so, bu...
Has anybody forked PHP4 to continue support for this version?
EDIT: This isn't a question about migrating to PHP5.
...
My friend has allowed me to have access to his server, he has been coding PHP a lot longer than me and still uses php version 4.3.9 and doesn't want to upgrade this current version. Is there anyway for me to install php version 5.2 and use that while he still runs 4.3.9? I require some functions which are only available in 5.2. The serve...
At the end of a page, if something occurs, it needs to be cleared, then the entire page needs to be re-parsed before serving to the client. I was going to echo out a javascript to refresh the page, but that will make them load the page and then reload it...I was wondering if there was a way to just tell the php engine to go back to the b...
I have a script running on a server with PHP4 that uses DOMXML. Now I have to migrate the site (incl. the script) to a new server running PHP5 and it seems that DOMXML isn't working properly anymore. Is there an easy way to fix this?
Thanks.
...
I have a server that hosts a bunch of sites in PHP5. I have an old site that was designed for PHP4 that I also need on the server.
Originally, I was just going to port the code to PHP5, but have discovered that process is more intense that I have time for so I need to have PHP4 and PHP5 running on the same Server 2008 box.
I think thi...
I have recently taken on a php web developer position for a large firm. They have multiple sites that share much of the same content (mainly news articles). All the sites although written in PHP, the content is static and manually edited on all the sites when a news article is added or other information is changed. The "senior programme...
I have a weird problem with PHP4
I have a class which assigns a $_SESSION variable.
On the local dev server it works as:
$_SESSION['foo'] = $this->foo;
and I can access $_SESSION['foo'] as a string.
on the live server $_SESSION['foo'] is not a string but a serialized object? the same code?
...
Hello,
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:
<soapenv:Envelope ...
xmlns:ns1="http://domain.tld/namespace1"
xmlns:ns2="http://domain.tld/namespace2">
<soapenv:Header/>
<s...
OK my client wants to show a buy both feature in the cart, if they have 1 particular item type in the cart they want it to show up for another particular item type so if they buy both they can save $50 off the total. I am trying to wrap my head around what would be the best way to set this up so it couldn't be easily hacked (ie: adding b...
I have a site that is written completely in PHP4 - the supported version on my hosting at the time. After tons of time on this language, I've come to see that PHP5 has a lot of stuff that I think would be useful to me.
Two questions:
Would switching my hosting to PHP5 cause any serious damage to existing PHP4 scripting?
Is PHP5 consi...
I want to create links to pages and content that are in protected directories. I didn't program the protected directories I set them up from the host admin page.
I want to be able to give links to user that will take them to page and login as well.
Also if there is a way I want to be able to embed content from the protected directorie...