473,386 Members | 1,973 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,386 software developers and data experts.

Repeating references

nathj
938 Expert 512MB
Hi,

Some programming languages have a WITH statement that allows you to do something like this (psuedo code):

with myobject
.property1 = variable1
.property2 = variable2
.method()
endwith


I know that's a bit rough but hopefully you get the idea. Is this possible in PHP? It would prevent me typing $this-> alot.

Cheers
nathj
Jul 26 '07 #1
2 1090
kovik
1,044 Expert 1GB
Even in languages that have the WITH statement, it is highly advised against. PHP does not support it at all as it's worthless. If you used it, then how would you differentiate between a global function and a class function?
Jul 26 '07 #2
nathj
938 Expert 512MB
Even in languages that have the WITH statement, it is highly advised against. PHP does not support it at all as it's worthless. If you used it, then how would you differentiate between a global function and a class function?
Okay, in the language I used it in the syntax:
object.property=1
object.property2=2
object.method()

would be replaced with

WITH object
.property=1
.property2=2
.method()
ENDWITH

The presence of the '.' indicates that it is a member of the object.

I was developing in Visual FoxPro and I believe VB has something similar. In my old development language the WITH structure speeds up code as it only checks the object once rather than every time. This is increasingly imortant in visual development for desktop apps when you may be manipulating a class several layers down. You only need to define the path to it once.

As it si not in PHP I can't use it. I just thought I would double check here on thescripts.

Cheers
nathj
Jul 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: news | last post by:
Well, I wrote my first PHP class today. Yeah! But to get it to work, in each function within the class I have to repeat the database connection lines, and that just seems redundant; there has to...
0
by: dino07 | last post by:
Hi All, I am currently trying to do the following: 1. insert a value into a repeating table from a drop-down list( secondary storage) when the user click the "Add" button positioned next to the...
11
by: Christoph Boget | last post by:
When building a form using Infopath, you can define a repeating section and stick form fields in that section. I'm curious if ASP.NET has a similar control to make it easy to design something...
2
by: nickheppleston | last post by:
I'm trying to iterate through repeating elements to extract data using libxml2 but I'm having zero luck - any help would be appreciated. My XML source is similar to the following - I'm trying to...
3
by: bagelman | last post by:
Hi, I want to find repeating words in a long string with Regular Expressions. I tried to write a regular expression but it didn't work. "\b(?<word>\w+)\s+(\k<word>)\b" This RegEx finds...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...

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.