473,409 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Some quick PHP questions

Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($form = new Form());

Secondly, I've been reading a tutorial and noticed the use of an "&" in
front of the word "new" when instantiating a new object. See example below,
I just wondered what is it's significance? The code was purely a snippet.
$textField1 = &new inputTextObject("blah", "blah", "blah");

Cheers

Phil
Mar 7 '07 #1
4 1262
Phil Latio wrote:
Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($form = new Form());
Yes.
Secondly, I've been reading a tutorial and noticed the use of an "&" in
front of the word "new" when instantiating a new object. See example
below, I just wondered what is it's significance? The code was purely a
snippet. $textField1 = &new inputTextObject("blah", "blah", "blah");
The ampersand sign ("&") is the reference operator; it has no use at all
when creating new instances.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Dios os ha dado una cara y vosotros os hacéis otra.- Shakespeare.
Mar 7 '07 #2
Iván Sánchez Ortega wrote:
Phil Latio wrote:
>Secondly, I've been reading a tutorial and noticed the use of an "&" in
front of the word "new" when instantiating a new object. See example
below, I just wondered what is it's significance? The code was purely a
snippet. $textField1 = &new inputTextObject("blah", "blah", "blah");

The ampersand sign ("&") is the reference operator; it has no use at all
when creating new instances.
No use when creating new instance under PHP5,
Under PHP4 it makes quite a difference.
Mar 7 '07 #3

"Hendri Kurniawan" <as****@email.comwrote in message
news:12*************@corp.supernews.com...
Iván Sánchez Ortega wrote:
>Phil Latio wrote:
>>Secondly, I've been reading a tutorial and noticed the use of an "&" in
front of the word "new" when instantiating a new object. See example
below, I just wondered what is it's significance? The code was purely a
snippet. $textField1 = &new inputTextObject("blah", "blah", "blah");

The ampersand sign ("&") is the reference operator; it has no use at all
when creating new instances.

No use when creating new instance under PHP5,
Under PHP4 it makes quite a difference.
That explains it. I think the tutorial was originally written for PHP4 or at
least the author wanted compatibility with PHP4.

Cheers

Phil
Mar 7 '07 #4

"Iván Sánchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
wrote in message news:es**********@hercules.cohp1...
Phil Latio wrote:
>Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($form = new Form());

Yes.
Thanks for this.

Cheers

Phil
Mar 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Elaine Jackson | last post by:
Two quick newbie questions: 1) Does Python have passing-by-reference? 2) In ordinary parlance, "deep" implies "shallow" but not conversely. In the Python "copy" module (if I understand...
1
by: YT | last post by:
Couple of quick ASP (3.0) Cookie questions: 1/ I'm using a cookie in my asp script to place cookies (within a key) so my code looks like: Response.Cookies( "quoteform" )( "name" ) = Session(...
0
by: Stuart | last post by:
Hi, I am relatively new to Cocoon and have some quick questions as to how it processes its pipelines: 1. I assume that each stage in a pipeline must complete fully before the next phase is...
8
by: Dutchy | last post by:
Dear reader, In an attempt to obtain the path to the quick-launch-folder in order to create a shortcut to my application-updates during installation , I thought to: 1- check if quick launch...
7
by: kamkwokho | last post by:
Could any answer following questions as many as you can. ii) Write a C shell script convertmin which will read in a number, thought of as representing minutes, and print out the number of...
34
by: Karam Chand | last post by:
Hello I have been working with Access and MySQL for pretty long time. Very simple and able to perform their jobs. I dont need to start a flame anymore :) I have to work with PGSQL for my...
55
by: Steven Nagy | last post by:
Hi all, Sorry I have no time to test this myself.... Can I add the same attribute to a field twice? Eg. Public string myField;
0
by: netguru7575 | last post by:
All Quick Test Professional (QTP) FAQs QuickTest Professional (QTP) Questions and Answers Part # 1 http://softwareqatestings.com/content/view/188/38/
6
by: SuperDuper | last post by:
Just a few quick questions. 1) How would I count the length of words in 5 certain strings. SomeString.s1, SomeString.s2, etc.. 2) How to compute the average word length? 3) How to compute...
4
by: NvrBst | last post by:
A few quick questions if possible. 1 - If I have a "List<..myList" and set it as a datasouce for say ListBox1, then change items in "myList" is the correct/only way to update the ListBox with...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.