converting code in PHP5 to PHP4

This is a discussion on converting code in PHP5 to PHP4 within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I want to convert pajaj php5 code into php4 code. I removed public and private very easily. But the ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-01-2006
sam
 
Posts: n/a
Default converting code in PHP5 to PHP4

Hi,

I want to convert pajaj php5 code into php4 code.
I removed public and private very easily. But the static and few
others (can't remember right now) are hard to deal with. How to simulate
a static variable in php4?

Thanks
Sam
Reply With Quote
  #2 (permalink)  
Old 02-04-2006
Oli Filth
 
Posts: n/a
Default Re: converting code in PHP5 to PHP4

sam said the following on 01/02/2006 09:46:
> Hi,
>
> I want to convert pajaj php5 code into php4 code.
> I removed public and private very easily. But the static and few others
> (can't remember right now) are hard to deal with. How to simulate a
> static variable in php4?



Well, the simple answer is: don't attempt to use PHP 4 for any kind of
sensible OOP, it's simply not geared up to do anything useful in this
respect. It's a bit like asking "how can I simulate a static class
member using assembler?".

However, whilst I'm too drunk to offer anything better, will something
like the following be of any use:

class Foo
{
function variable($newVar = NULL)
{
static $var;
if ($newVar != NULL)
{
$var = $newVar;
}
return $var;
}
}


Foo::variable(6);
echo Foo::variable();




--
Oli
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0