473,666 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Some quick PHP questions

Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($fo rm = 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 1276
Phil Latio wrote:
Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($fo rm = 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.c omwrote in message
news:12******** *****@corp.supe rnews.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.coh p1...
Phil Latio wrote:
>Firstly, is the following code allowed assuming the addContent function
expects as single argument?
$page->addContent($fo rm = 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
2071
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 correctly), the implication goes the other way. Do you find this a nuisance? Peace, EJ
1
1528
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( "name" ) Response.Cookies( "quoteform" )( "organization" ) = Session( "organization" ) Response.Cookies( "quoteform" )( "address1" ) = Session( "address" ) Response.Cookies( "quoteform" )( "address2" ) = Session( "suite" ) Response.Cookies(...
0
997
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 invoked, right? In other words, it is a serial, step-by-step pipeline, not one that ever works in parallel a la classic reader-writer processes sharing a buffer.
8
5371
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 is used by the user 2- check if a link to my application is there 3- if so, obtain the path (ANY PATH) to the quick-launch-folder from existing button(s)
7
3540
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 hours/minutes it represents so: $ convertmin Enter a number of minutes: 128
34
5037
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 companies current project. I have been able to setup postgresql in my rh box and
55
2706
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
2575
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
5441
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 the standard deviation (without duplicating code) 4) How to do all of this without duplicating the code for each String.
4
1279
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 the following? ListBox1.DataSource = null; ListBox1.DataSource = myList; 2 - BindingList<...is the same as List<...except when it is set as
0
8445
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8871
Oralloy
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...
0
8781
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 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...
1
8551
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,...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
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...
1
2771
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
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...

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.