Consider this cde:
/**********
class testClass {
var $value = 6;
}
function &getInstance () {
static $instance;
if(!isset($inst ance)) {
$instance = new testClass;
}
return $instance;
}
echo getInstance()->value;
/**********/
In PHP5, this correctly echos '6'. However, in PHP4, I get
Parse error: syntax error, unexpected T_OBJECT_OPERAT OR, expecting ','
or ';' in /test.php on line 16
I do need to the code in this format, without splitting it into two
lines (which I know works). It would be detrimental to my project if
it turns out this won't work at all :-\ 1 1255
..oO(Ryan Govostes)
>Consider this cde: [...]
echo getInstance()->value; /**********/
In PHP5, this correctly echos '6'. However, in PHP4, I get
Parse error: syntax error, unexpected T_OBJECT_OPERAT OR, expecting ',' or ';' in /test.php on line 16
PHP 4 doesn't support this syntax.
>I do need to the code in this format, without splitting it into two lines (which I know works). It would be detrimental to my project if it turns out this won't work at all :-\
If you really want to use OOP and its features, then drop PHP 4 and use
PHP 5.
PHP 4 is reaching its end of life this year (see <http://www.php.net/>),
while PHP 6 is going to see the light of day in maybe a few months.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Daniel |
last post by:
Hello =)
I have an object which contains a method that should execute every x ms. I
can use setInterval inside the object construct like this -
self.setInterval('ObjectName.methodName()', this.pinginterval);
- but is there no way to do this without using the literal ObjectName? If I
write 'this.methodName()' I get "Line 1 Char 1: Object doesn't support this
property or method." in IE, and nothing happens in Firebird.
|
by: SP |
last post by:
Hi I have a problem with a customer's XML being submitting to me in a
non-well-format XML.
They said that there are 18 other partners who has been able to tweak the
XML to make it work.
So I guess here is my question, in ASP, when working with XML, how do you
handle non-well-formed XML documents on the "listener" response side?
Here's the scenerio:
Customer post XML Data to us (non-well-formed XML)
|
by: E. Robert Tisdale |
last post by:
What is an object?
Where did this term come from?
Does it have any relation
to the objects in "object oriented programming"?
|
by: ST |
last post by:
Hello everyone, Can anyone help me with this error above when I debug my web
app project in vstudio.net?? I can't figure it out! It was working fine for
months, and now all of a sudden it's not!!
This is the error:
biopsy.searchsubject.btnSubject_Click(Object Sender, EventArgs e) in
C:\INetPub\WWWRoot\biopsy\searchsubject.aspx.vb:198
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
|
by: gg9h0st |
last post by:
i worte a simple code below.
------------------------------------------------------------------------------------
#include "stdafx.h"
class Object {
public:
int a;
| |
by: NC AQUA |
last post by:
Evening everyone...
First, this is a homework assignment and I am not looking for the direct answer (notice no code...), but instead I need direction to help figure this out. I am new to this and do not plan on continuing after this class. Not my forte...
I have to encrypt and decrypt a char pointer. I have passed the pointer to the encrypt function (debug code reveals - output statement). I need to increase the value by 1 in the encrypt...
|
by: Stephen Cattaneo |
last post by:
Hi all,
I am relatively new to socket programming. I am attempting to use raw
sockets to spoof my IP address. From what I can tell I will have to
build from the Ethernet layer on up. This is fine, but I am having
some trouble with manipulating my hex values.
Seems to me that there are two ways to store hex values:
1. as literal hex - 0x55aa
2. as a string - "\x55aa"
|
by: Paul Childs |
last post by:
Hi folks,
I'll start off with the code I wrote...
(ActivePython 2.4 on Windows XP SP2)
-------------------------------
class FlightCondition(object):
lsf =
vto =
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |