473,386 Members | 1,804 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.

Bits an pieces

I'm having some difficulty in finding references and definitions of
language constructs. By their nature they are hard to search for. For
instance I use

foreach($array as $key=>$value){ etc..}

But what is ' =>' called?

I've got similar confusion with the &

I know I've got to do some study (eventually) of OO techniques but they
also use symbols which are hard to find. e.g. '->', '::'
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #1
5 1445
Geoff Berrow <bl******@ckdog.co.uk> wrote in
news:l9********************************@4ax.com:
I'm having some difficulty in finding references and definitions of
language constructs. By their nature they are hard to search for. For
instance I use

foreach($array as $key=>$value){ etc..}

But what is ' =>' called?
I'm not sure if PHP even has a name for it. In C, the equivalents (i.e.
-> and .) are often referred to as the "member" operator, because they're
pointing to a member of a class or structure.
I've got similar confusion with the &
This is the called the "bitwise and" operator. You're far more likely to
run into &&, which is simply another way of writing "and" - the "logical
and" operator. It's a fair bet that if you needed to use the bitwise &,
you'd already know what it does.
I know I've got to do some study (eventually) of OO techniques but they
also use symbols which are hard to find. e.g. '->', '::'
When you have a couple of spare hours, go over the basics in the PHP
manual, <http://php.net/manual>. The manual is laid out such that even if
you don't know the name of what you're looking for, you can probably find
it by scanning the Table of Contents or one of the main sections. For
example, if you know you're going to be dealing with an array e.g.
foreach($array as $key=>$value){ etc..}


....you could find the "Language Reference > Types > Arrays" and "Array
Functions" sections fairly quickly. Even if (as in my case and yours) you
don't know for sure what the => is called.

hth
--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #2
*** Geoff Berrow wrote/escribió (Fri, 11 Feb 2005 07:48:34 +0000):
I'm having some difficulty in finding references and definitions of
language constructs.


http://www.php.net/manual/en/langref.php
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Jul 17 '05 #3
On Fri, 11 Feb 2005 07:48:34 +0000, Geoff Berrow <bl******@ckdog.co.uk> wrote:
I'm having some difficulty in finding references and definitions of
language constructs. By their nature they are hard to search for. For
instance I use

foreach($array as $key=>$value){ etc..}

But what is ' =>' called?
Well, PHP has some Perl roots, where => is called a "fat comma" due to it
being just syntactic sugar in hashes. The name probably makes even less sense
in PHP.

I always read loops as above as "foreach array as key 'to' value". In the gory
depths of the Zend PHP language parser, it's referred to as "T_DOUBLE_ARROW".
I've got similar confusion with the &
Reference operator; similar to C++, although it's postfix there - when a
prefix in C++ and C it's the "address of" operator.
I know I've got to do some study (eventually) of OO techniques but they
also use symbols which are hard to find. e.g. '->', '::'


-> would be something like "member operator" or "dereferencing operator". The
parser calls it "T_OBJECT_OPERATOR".

:: is the "scope resolution operator".

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4
I noticed that Message-ID: <he********************************@4ax.com>
from Andy Hassall contained the following:
foreach($array as $key=>$value){ etc..}

But what is ' =>' called?
Well, PHP has some Perl roots, where => is called a "fat comma" due to it
being just syntactic sugar in hashes. The name probably makes even less sense
in PHP.


Hmmm, you're right.
I always read loops as above as "foreach array as key 'to' value". In the gory
depths of the Zend PHP language parser, it's referred to as "T_DOUBLE_ARROW".


I kind of like the idea that we all use something regularly that doesn't
appear to have a name. :-)

I propose we call it the 'andits' operator.

$key andits $value. geddit?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5
Andy Hassall wrote:
:: is the "scope resolution operator".


In the gory depths of the Zend PHP language parser, also known as
T_PAAMAYIM_NEKUDOTAYIM.

Do something like this:

$class::method();

and watch the error message.

JP

--
Sorry, <de*****@cauce.org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
Jul 17 '05 #6

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

Similar topics

40
by: aku | last post by:
I'm looking for the absolute fastest way to count the nr of bits that are set to "1" in a string. Presumably I then first need the fastest way to do this in a byte. I think this is it, but...
2
by: pedagani | last post by:
Problem: read 'nBits' (where 0< nbits <= 32) from a buffer 'buffer' at a byte position 'pos' with a *bit* offset value of 'bitOffset'. Below is the code that does that (not tested for errors),...
2
by: Jenny | last post by:
Hello All! I have a long XML file that I should transmit to other computer using http. Problem is that the whole XML Document is too large for one transmitting. What is the nicest way to...
1
by: Flemming Hansen | last post by:
Hi guys, I want to load a binary file in to an array by splitting the file in 8 bit pieces. I mean: FileStream s = new FileStream(path, FileMode.OpenOrCreate); // Open StreamReader r = new...
16
by: sajin | last post by:
Hi All, I am building a windows application in VB .Net 2005 , and for deploying the application i need to run some exe's if it is 32 bits and some other exe's for 64 bits Can anyone tell me...
11
by: Mack | last post by:
Hi all, I want to write a program to count number of bits set in a number. The condition is we should not loop through each bit to find whether its set or not. Thanks in advance, -Mukesh
77
by: borophyll | last post by:
As I read it, C99 states that a byte is an: "addressable unit of data storage large enough to hold any member of the basic character set of the execution environment" (3.6) and that a byte...
1
by: benn | last post by:
I have a microcontroller that I wish to send status data (via serial RS-232) out to a PC com port. Im trying to minimize the amount of bytes I transmit, so I want the micro to bit-pack various...
11
by: JoeC | last post by:
I am working on a graphics program but my question has nothing to do with graphics but trying to get an algorithm to work. I set graphics from a 16x16 grid to bits of a graphic with: bitData =...
15
by: fyi | last post by:
My new blog on bits and pieces of PHP coding. http://bitspiecesphp.blogspot.com/ Have used all of them. Hope they're as useful to others: Use PHP to track email sender from your web site...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.