php-general Digest 11 Oct 2012 01:36:53 -0000 Issue 8001

Topics (messages 319404 through 319419):

Re: limiting
        319404 by: Floyd Resler
        319405 by: Jim Giner
        319406 by: Matijn Woudt
        319407 by: David McGlone
        319408 by: Jim Giner
        319409 by: Govinda
        319410 by: David McGlone
        319411 by: Tim Streater
        319412 by: David McGlone
        319413 by: Ashley Sheridan
        319414 by: Matijn Woudt
        319415 by: Matijn Woudt
        319416 by: Tim Streater
        319417 by: Jim Giner
        319418 by: Jim Giner
        319419 by: tamouse mailing lists

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---

On Oct 10, 2012, at 9:12 AM, Andy McKenzie <amckenz...@gmail.com> wrote:

> <snip>
>>> Have you read a book on php and perhaps one on CSS to help
>>> with your "hiding" problem?  (BTW - that last was a hint.)
>> 
>> I've read plenty of PHP books I own at least 5 and ALL of them I've read
>> hardly ever explain anything at all. They just throw some code in there and
>> say "this is what it does" and gives a picture of the finished product. Total
>> waste of my money! Also, how am I going to learn PHP if I've got to mix it 
>> all
>> up with CSS. It's just going to make things harder and more confusing on me. 
>> I
>> only threw lightbox in there because I knew I didn't have to do or learn
>> anything special and to put a smile on my face if it worked. After all, if it
>> can't be fun, why do it?
> </snip>
> 
> I rarely post anything to this list, because almost everything asked
> is above my level of understanding.  But, speaking as a relative
> beginner, I have a few comments here.
> 
> 1) Books.  I, too, have read a lot of PHP books.  In the end, the ones
> I've found most useful were by WROX press.  Their "Beginning PHP4" by
> Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to
> programming" type books I've found for the way I learn.  It's now
> obsolete, but the core information is still good.  I haven't read
> through the Beginning PHP 5.3 version as thoroughly, but it also seems
> to be pretty good.  You might also want to check with local community
> colleges to see if someone offers a basic course -- PHP, C, C++,
> something like that.  The language may be different, but the concepts
> remain the same.
> 
> 2)  "They just throw some code in there and say "this is what it does"
> and gives a picture of the finished product. Total waste of my money!
> Also, how am I going to learn PHP if I've got to mix it all up with
> CSS."
> 
>  This one's harder.  These days CSS is part of the web, and you're
> stuck with it if you want to do anything complex.  So here's my
> advice:  Find something simple to experiment with.  Don't start with a
> complex project, start with something that doesn't actually do
> anything useful.  When I start trying to understand a function I
> haven't used before, I build a new page called something like
> "foo_test", where foo is the name of the function.  These days it
> might be ip2long_test, or something like that, but I still have some
> in my test folder with names like "echo_test.php" where I was trying
> to figure out how that function worked.  Start there.  Do something
> simple.  Lightbox may be too complex.  Maybe build a fortune cookie
> webpage, where every time you click a button it reloads with a new
> fortune.  Learn to pull fortunes out of a file and out of a database.
> Once you've got the hang of that, start using CSS to change how it
> looks.  Once THAT's working right, figure out how to use JavaScript
> (you're going to need it sooner or later!) and AJAX to make it reload
> the fortune without reloading the whole page.
> 
>  Yeah, it's a boring project.  But it's a stepping stone to doing
> what you really want to do.  The alternative is to do what I did:
> start with a big project, and accept that you're going to rewrite it
> dramatically later.  I started with a book inventory system.  First I
> built a login and authentication system -- that builds a form, and
> queries the database to see if the userid and password are correct.
> Then I built a system to list what was in the book table for the
> database.  Around the time I finished that, I realized I needed more
> granularity in user logins, so I went back and rebuilt the login tool.
> Then I realized I didn't actually have a way to add stuff to the DB,
> so I built that tool.... and so on.  It ended up taking me something
> like a year, because I'd never looked at PHP before, and I've now
> scrapped the entire project and rebuilt it.  Why?  Because I did just
> about everything wrong.  It just plain wasn't practical to try to fix
> it.  I'd never learned the basics, I just threw myself at a big
> project to see what would happen.
> 
>  Good luck!
> 
> -Andy McKenzie

Excellent advise!  When learning any language, those small steps you suggest is 
how I've always learned the language.  A few years ago I ran across someone who 
didn't know a thing about programming but wanted to learn.  The first project 
he wanted to tackle was to write his own online role playing game.  You know, 
like World of Warcraft!  Uh, yeah.  I steered him away from that!

Take care,
Floyd


--- End Message ---
--- Begin Message ---
On 10/10/2012 10:07 AM, Floyd Resler wrote:


On Oct 10, 2012, at 9:12 AM, Andy McKenzie <amckenz...@gmail.com> wrote:

<snip>
Have you read a book on php and perhaps one on CSS to help
with your "hiding" problem?  (BTW - that last was a hint.)

I've read plenty of PHP books I own at least 5 and ALL of them I've read
hardly ever explain anything at all. They just throw some code in there and
say "this is what it does" and gives a picture of the finished product. Total
waste of my money! Also, how am I going to learn PHP if I've got to mix it all
up with CSS. It's just going to make things harder and more confusing on me. I
only threw lightbox in there because I knew I didn't have to do or learn
anything special and to put a smile on my face if it worked. After all, if it
can't be fun, why do it?
</snip>

I rarely post anything to this list, because almost everything asked
is above my level of understanding.  But, speaking as a relative
beginner, I have a few comments here.

1) Books.  I, too, have read a lot of PHP books.  In the end, the ones
I've found most useful were by WROX press.  Their "Beginning PHP4" by
Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to
programming" type books I've found for the way I learn.  It's now
obsolete, but the core information is still good.  I haven't read
through the Beginning PHP 5.3 version as thoroughly, but it also seems
to be pretty good.  You might also want to check with local community
colleges to see if someone offers a basic course -- PHP, C, C++,
something like that.  The language may be different, but the concepts
remain the same.

2)  "They just throw some code in there and say "this is what it does"
and gives a picture of the finished product. Total waste of my money!
Also, how am I going to learn PHP if I've got to mix it all up with
CSS."

  This one's harder.  These days CSS is part of the web, and you're
stuck with it if you want to do anything complex.  So here's my
advice:  Find something simple to experiment with.  Don't start with a
complex project, start with something that doesn't actually do
anything useful.  When I start trying to understand a function I
haven't used before, I build a new page called something like
"foo_test", where foo is the name of the function.  These days it
might be ip2long_test, or something like that, but I still have some
in my test folder with names like "echo_test.php" where I was trying
to figure out how that function worked.  Start there.  Do something
simple.  Lightbox may be too complex.  Maybe build a fortune cookie
webpage, where every time you click a button it reloads with a new
fortune.  Learn to pull fortunes out of a file and out of a database.
Once you've got the hang of that, start using CSS to change how it
looks.  Once THAT's working right, figure out how to use JavaScript
(you're going to need it sooner or later!) and AJAX to make it reload
the fortune without reloading the whole page.

  Yeah, it's a boring project.  But it's a stepping stone to doing
what you really want to do.  The alternative is to do what I did:
start with a big project, and accept that you're going to rewrite it
dramatically later.  I started with a book inventory system.  First I
built a login and authentication system -- that builds a form, and
queries the database to see if the userid and password are correct.
Then I built a system to list what was in the book table for the
database.  Around the time I finished that, I realized I needed more
granularity in user logins, so I went back and rebuilt the login tool.
Then I realized I didn't actually have a way to add stuff to the DB,
so I built that tool.... and so on.  It ended up taking me something
like a year, because I'd never looked at PHP before, and I've now
scrapped the entire project and rebuilt it.  Why?  Because I did just
about everything wrong.  It just plain wasn't practical to try to fix
it.  I'd never learned the basics, I just threw myself at a big
project to see what would happen.

  Good luck!

-Andy McKenzie

Excellent advise!  When learning any language, those small steps you suggest is 
how I've always learned the language.  A few years ago I ran across someone who 
didn't know a thing about programming but wanted to learn.  The first project 
he wanted to tackle was to write his own online role playing game.  You know, 
like World of Warcraft!  Uh, yeah.  I steered him away from that!

Take care,
Floyd

All great advice but alas, I fear that my long-winded response that began all these succeeding advice columns has steered our OP away from this list. He thinks we're above his level (we are) and that he needs to start somewhere else, which means he'll probably repeat the mistakes that have been mentioned here. Oh, well.... you can only help those who ask for it, and only if they know what to do with it.
--- End Message ---
--- Begin Message ---
On Wed, Oct 10, 2012 at 5:12 PM, Jim Giner <jim.gi...@albanyhandball.com> wrote:
> On 10/10/2012 10:07 AM, Floyd Resler wrote:
>>
>>
>>
>> On Oct 10, 2012, at 9:12 AM, Andy McKenzie <amckenz...@gmail.com> wrote:
>>
>>> <snip>
>>>>>
>>>>> Have you read a book on php and perhaps one on CSS to help
>>>>> with your "hiding" problem?  (BTW - that last was a hint.)
>>>>
>>>>
>>>> I've read plenty of PHP books I own at least 5 and ALL of them I've read
>>>> hardly ever explain anything at all. They just throw some code in there
>>>> and
>>>> say "this is what it does" and gives a picture of the finished product.
>>>> Total
>>>> waste of my money! Also, how am I going to learn PHP if I've got to mix
>>>> it all
>>>> up with CSS. It's just going to make things harder and more confusing on
>>>> me. I
>>>> only threw lightbox in there because I knew I didn't have to do or learn
>>>> anything special and to put a smile on my face if it worked. After all,
>>>> if it
>>>> can't be fun, why do it?
>>>
>>> </snip>
>>>
>>> I rarely post anything to this list, because almost everything asked
>>> is above my level of understanding.  But, speaking as a relative
>>> beginner, I have a few comments here.
>>>
>>> 1) Books.  I, too, have read a lot of PHP books.  In the end, the ones
>>> I've found most useful were by WROX press.  Their "Beginning PHP4" by
>>> Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to
>>> programming" type books I've found for the way I learn.  It's now
>>> obsolete, but the core information is still good.  I haven't read
>>> through the Beginning PHP 5.3 version as thoroughly, but it also seems
>>> to be pretty good.  You might also want to check with local community
>>> colleges to see if someone offers a basic course -- PHP, C, C++,
>>> something like that.  The language may be different, but the concepts
>>> remain the same.
>>>
>>> 2)  "They just throw some code in there and say "this is what it does"
>>> and gives a picture of the finished product. Total waste of my money!
>>> Also, how am I going to learn PHP if I've got to mix it all up with
>>> CSS."
>>>
>>>   This one's harder.  These days CSS is part of the web, and you're
>>> stuck with it if you want to do anything complex.  So here's my
>>> advice:  Find something simple to experiment with.  Don't start with a
>>> complex project, start with something that doesn't actually do
>>> anything useful.  When I start trying to understand a function I
>>> haven't used before, I build a new page called something like
>>> "foo_test", where foo is the name of the function.  These days it
>>> might be ip2long_test, or something like that, but I still have some
>>> in my test folder with names like "echo_test.php" where I was trying
>>> to figure out how that function worked.  Start there.  Do something
>>> simple.  Lightbox may be too complex.  Maybe build a fortune cookie
>>> webpage, where every time you click a button it reloads with a new
>>> fortune.  Learn to pull fortunes out of a file and out of a database.
>>> Once you've got the hang of that, start using CSS to change how it
>>> looks.  Once THAT's working right, figure out how to use JavaScript
>>> (you're going to need it sooner or later!) and AJAX to make it reload
>>> the fortune without reloading the whole page.
>>>
>>>   Yeah, it's a boring project.  But it's a stepping stone to doing
>>> what you really want to do.  The alternative is to do what I did:
>>> start with a big project, and accept that you're going to rewrite it
>>> dramatically later.  I started with a book inventory system.  First I
>>> built a login and authentication system -- that builds a form, and
>>> queries the database to see if the userid and password are correct.
>>> Then I built a system to list what was in the book table for the
>>> database.  Around the time I finished that, I realized I needed more
>>> granularity in user logins, so I went back and rebuilt the login tool.
>>> Then I realized I didn't actually have a way to add stuff to the DB,
>>> so I built that tool.... and so on.  It ended up taking me something
>>> like a year, because I'd never looked at PHP before, and I've now
>>> scrapped the entire project and rebuilt it.  Why?  Because I did just
>>> about everything wrong.  It just plain wasn't practical to try to fix
>>> it.  I'd never learned the basics, I just threw myself at a big
>>> project to see what would happen.
>>>
>>>   Good luck!
>>>
>>> -Andy McKenzie
>>
>>
>> Excellent advise!  When learning any language, those small steps you
>> suggest is how I've always learned the language.  A few years ago I ran
>> across someone who didn't know a thing about programming but wanted to
>> learn.  The first project he wanted to tackle was to write his own online
>> role playing game.  You know, like World of Warcraft!  Uh, yeah.  I steered
>> him away from that!
>>
>> Take care,
>> Floyd
>>
> All great advice but alas, I fear that my long-winded response that began
> all these succeeding advice columns has steered our OP away from this list.
> He thinks we're above his level (we are) and that he needs to start
> somewhere else, which means he'll probably repeat the mistakes that have
> been mentioned here.  Oh, well....  you can only help those who ask for it,
> and only if they know what to do with it.
>

I doubt he's gone for good. Looking at the archives[1], he shows up
once in a few months with some random question (making same mistakes
over again).
So if he's gone now, he'll probably show up in a few months.

[1] http://marc.info/?a=125667564200003&r=1&w=2

--- End Message ---
--- Begin Message ---
On Wednesday, October 10, 2012 05:48:10 PM Matijn Woudt wrote:
> On Wed, Oct 10, 2012 at 5:12 PM, Jim Giner <jim.gi...@albanyhandball.com> 
wrote:
> > On 10/10/2012 10:07 AM, Floyd Resler wrote:
> >> On Oct 10, 2012, at 9:12 AM, Andy McKenzie <amckenz...@gmail.com> wrote:
> >>> <snip>
> >>> 
> >>>>> Have you read a book on php and perhaps one on CSS to help
> >>>>> with your "hiding" problem?  (BTW - that last was a hint.)
> >>>> 
> >>>> I've read plenty of PHP books I own at least 5 and ALL of them I've
> >>>> read
> >>>> hardly ever explain anything at all. They just throw some code in there
> >>>> and
> >>>> say "this is what it does" and gives a picture of the finished product.
> >>>> Total
> >>>> waste of my money! Also, how am I going to learn PHP if I've got to mix
> >>>> it all
> >>>> up with CSS. It's just going to make things harder and more confusing
> >>>> on
> >>>> me. I
> >>>> only threw lightbox in there because I knew I didn't have to do or
> >>>> learn
> >>>> anything special and to put a smile on my face if it worked. After all,
> >>>> if it
> >>>> can't be fun, why do it?
> >>> 
> >>> </snip>
> >>> 
> >>> I rarely post anything to this list, because almost everything asked
> >>> is above my level of understanding.  But, speaking as a relative
> >>> beginner, I have a few comments here.
> >>> 
> >>> 1) Books.  I, too, have read a lot of PHP books.  In the end, the ones
> >>> I've found most useful were by WROX press.  Their "Beginning PHP4" by
> >>> Choi, Kent, Lea, Prasad, and Ullman was one of the best "intro to
> >>> programming" type books I've found for the way I learn.  It's now
> >>> obsolete, but the core information is still good.  I haven't read
> >>> through the Beginning PHP 5.3 version as thoroughly, but it also seems
> >>> to be pretty good.  You might also want to check with local community
> >>> colleges to see if someone offers a basic course -- PHP, C, C++,
> >>> something like that.  The language may be different, but the concepts
> >>> remain the same.
> >>> 
> >>> 2)  "They just throw some code in there and say "this is what it does"
> >>> and gives a picture of the finished product. Total waste of my money!
> >>> Also, how am I going to learn PHP if I've got to mix it all up with
> >>> CSS."
> >>> 
> >>>   This one's harder.  These days CSS is part of the web, and you're
> >>> 
> >>> stuck with it if you want to do anything complex.  So here's my
> >>> advice:  Find something simple to experiment with.  Don't start with a
> >>> complex project, start with something that doesn't actually do
> >>> anything useful.  When I start trying to understand a function I
> >>> haven't used before, I build a new page called something like
> >>> "foo_test", where foo is the name of the function.  These days it
> >>> might be ip2long_test, or something like that, but I still have some
> >>> in my test folder with names like "echo_test.php" where I was trying
> >>> to figure out how that function worked.  Start there.  Do something
> >>> simple.  Lightbox may be too complex.  Maybe build a fortune cookie
> >>> webpage, where every time you click a button it reloads with a new
> >>> fortune.  Learn to pull fortunes out of a file and out of a database.
> >>> Once you've got the hang of that, start using CSS to change how it
> >>> looks.  Once THAT's working right, figure out how to use JavaScript
> >>> (you're going to need it sooner or later!) and AJAX to make it reload
> >>> the fortune without reloading the whole page.
> >>> 
> >>>   Yeah, it's a boring project.  But it's a stepping stone to doing
> >>> 
> >>> what you really want to do.  The alternative is to do what I did:
> >>> start with a big project, and accept that you're going to rewrite it
> >>> dramatically later.  I started with a book inventory system.  First I
> >>> built a login and authentication system -- that builds a form, and
> >>> queries the database to see if the userid and password are correct.
> >>> Then I built a system to list what was in the book table for the
> >>> database.  Around the time I finished that, I realized I needed more
> >>> granularity in user logins, so I went back and rebuilt the login tool.
> >>> Then I realized I didn't actually have a way to add stuff to the DB,
> >>> so I built that tool.... and so on.  It ended up taking me something
> >>> like a year, because I'd never looked at PHP before, and I've now
> >>> scrapped the entire project and rebuilt it.  Why?  Because I did just
> >>> about everything wrong.  It just plain wasn't practical to try to fix
> >>> it.  I'd never learned the basics, I just threw myself at a big
> >>> project to see what would happen.
> >>> 
> >>>   Good luck!
> >>> 
> >>> -Andy McKenzie
> >> 
> >> Excellent advise!  When learning any language, those small steps you
> >> suggest is how I've always learned the language.  A few years ago I ran
> >> across someone who didn't know a thing about programming but wanted to
> >> learn.  The first project he wanted to tackle was to write his own online
> >> role playing game.  You know, like World of Warcraft!  Uh, yeah.  I
> >> steered
> >> him away from that!
> >> 
> >> Take care,
> >> Floyd
> > 
> > All great advice but alas, I fear that my long-winded response that began
> > all these succeeding advice columns has steered our OP away from this
> > list.
> > He thinks we're above his level (we are) and that he needs to start
> > somewhere else, which means he'll probably repeat the mistakes that have
> > been mentioned here.  Oh, well....  you can only help those who ask for
> > it,
> > and only if they know what to do with it.
> 
> I doubt he's gone for good. Looking at the archives[1], he shows up
> once in a few months with some random question (making same mistakes
> over again).
> So if he's gone now, he'll probably show up in a few months.
> 
> [1] http://marc.info/?a=125667564200003&r=1&w=2

I'm not gone, I just quit posting on this subject, because things got so 
twisted along the way, that everyone is now perceiving me to not know the 
slightest thing about PHP and being someone I'm not!

In my very original post on this series, I was using opendir and someone had 
suggested using glob. Well I didn't know much about glob, because of course I 
hadn't got that far yet, but since someone else had backed up the suggestion 
from the original poster I was dumb enough to jump forward to the unknown and 
cause myself to get confused and flustered and my train of thought blew right 
out the window! But, I'm the kind of person that doesn't give up!

I was determined to figure out how to get glob to work for what I was trying to 
do because it was suggested by people who KNOW what they are doing and I KNOW 
they know what they are doing! I kept telling myself "glob is the answer", so 
really there's no reason to be SMUG about it!

 I should have went back to using opendir, but if I  did that, someone would 
be on my ass about that sooner or later, harping at me that they showed me how 
to use glob!

To top it off, I started dabbling and trying to learn PHP, back somewhere 
around early 2000 or 2001 and by that time I had my 2nd child on the way, but 
by 2002 I had had 3 kids born in '99, 2000 and 2002. So I had to put what I 
wanted to do on hold until here about a year ago, some things have changed 
since then in the PHP world and I'm pushing 45 years old and my brain isn't as 
sharp as it was 20 years ago!

So, yes I got confused, and I didn't know much about return because I hadn't 
used it yet but that doesn't give anyone the right to judge me on that basis!

With that said, I just may leave the list. After all if this is all I'm going 
to get out of it, it's not worth it!

 -- 
David M.


--- End Message ---
--- Begin Message ---
On 10/10/2012 1:19 PM, David McGlone wrote:

With that said, I just may leave the list. After all if this is all I'm going
to get out of it, it's not worth it!

  --
David M.


This list has given you some very good advice, much of it from others. It may not have solved your understanding of 'glob' (which is just another function - how could it alone mess up your project?) but it has felt your pain and offered you some ways to get up to speed. Don't leave - take the advice with the sentiment it was given and learn. This list is all about learning. Just don't tackle the Tour de France until you get your training wheels off! :)

BTW - in any of your other computer languages didn't they utilize a 'return' statement? PHP's is no different.
--- End Message ---
--- Begin Message ---
> [snip]
> With that said, I just may leave the list. After all if this is all I'm going 
> to get out of it, it's not worth it!
> [snip]
> 

Hi David,

it sounds like cliche, but you get out of it what you put in it.

I recommend: 
(If you *want* to write code, then:)

- don't get flustered; don't take any of this too seriously, esp. the emotional 
part (except the fun of creating); don't let the experts bother/intimidate you 
- just take from them what you can use, and ignore the rest.

- focus on what you are trying to do, ignore everything else.  Even experts who 
know what they are doing can easily get lost and waste time if they do not just 
focus on the one thing they originally set out to do, and just drop everything 
else.  Focus!

- break every problem down into smaller problems; everything is easy and simple 
once you isolate an unknown/unlearned thing/issue down to just that one thing.  
Build up your code in baby steps.  If you ask big questions that are actually 
conglomerates of many unknowns (black holes in your understanding), then 
experts don't know where to begin to help you, so they post those (these ;-)  
long-winded advice columns.  But do ask the/any forum/list, "Why does this one 
little thing behave like this ....", and you get instant expert useful answers 
every time.  You have to be the one to later glue together all the little 
things.  But you will be able to - if you have started with understanding how 
to do the little things that make up the larger thing you are creating.  Make 
sure you understand every little thing and nuance in your code.  

- resist the urge to just "get it to work" and then drop it.  One has to 
actually know HOW/WHY it works, and not just get lucky.  This is all logic, not 
luck.  Luck is not enough to rely on in coding.


There are many many people on this list who are feeling supportive of you...  
hoping you do not get discouraged, but do try again, and again.  :-)

-Govinda

--- End Message ---
--- Begin Message ---
----------  Forwarded Message  ----------

Subject: Re: [PHP] Re: limiting
Date: Wednesday, October 10, 2012, 02:03:57 PM
From: David McGlone <da...@dmcentral.net>
To: jim.gi...@albanyhandball.com


On Wednesday, October 10, 2012 01:31:58 PM Jim Giner wrote:
> On 10/10/2012 1:19 PM, David McGlone wrote:
> > With that said, I just may leave the list. After all if this is all I'm
> > going to get out of it, it's not worth it!
> > 
> >   --
> > 
> > David M.
> 
> This list has given you some very good advice, much of it from others.
> It may not have solved your understanding of 'glob' (which is just
> another function - how could it alone mess up your project?) 

At first is was going to be a project, because I thought that would help keep 
focus, but once I was introduced to glob it went from being a project, to a 
function to just plain code. I turned all my attention to glob and that little 
bit of code that I completely forgot I was trying keep focus by keeping it a 
project.


> but it has
> felt your pain and offered you some ways to get up to speed.  Don't
> leave - take the advice with the sentiment it was given and learn.  This
> list is all about learning.  Just don't tackle the Tour de France until
> you get your training wheels off! :)

Your advise was not what bothered me, it was way off base to say the least. 
What bothered me was the judgement that was cast upon me because I didn't 
understand return very well and when that came up, it added to my confusion 
and frusturation of trying to use glob which wasn't even my plan in the first 
place.
> 
> BTW - in any of your other computer languages didn't they utilize a
> 'return' statement?  PHP's is no different.

back in  like '85, I learned Pascal that's the only language I learned and I 
don't recall if it used return.

 -- 
David M.



-----------------------------------------

-- 
David M.


--- End Message ---
--- Begin Message ---
On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:

>>
>> BTW - in any of your other computer languages didn't they utilize a
>> 'return' statement?  PHP's is no different.
>
> back in  like '85, I learned Pascal that's the only language I learned and I
> don't recall if it used return.

Mmmm. There's the problem. Pascal doesn't *have* a return statement. In Pascal, 
implicitly, you return when execution reaches the end of a function. In fact 
the same is true of PHP and JavaScript, but in those languages you can return 
early just by saying return.

IMO, this is a major limitation of Pascal. I use returns wherever I feel like 
it - if I detect there's nothing more for the function to do, I return. Purists 
object to this; they say you should enter a function at one place and leave at 
one place. Well, that's a point of view. But more often that not it just leads 
to convoluted code in order to achieve that. The one time I *had* to use Pascal 
as that was the only option, I simply put a 999: label at the end of the 
function and did goto 999 wherever I wanted to do a return. Simples!

--
Cheers  --  Tim

--- End Message ---
--- Begin Message ---
On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
> On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:
> 
> 
> >>
> >>
> >> BTW - in any of your other computer languages didn't they utilize a
> >> 'return' statement?  PHP's is no different.
> >
> >
> >
> > back in  like '85, I learned Pascal that's the only language I learned and
> > I
 don't recall if it used return.
> 
> 
> Mmmm. There's the problem. Pascal doesn't *have* a return statement. In
> Pascal, implicitly, you return when execution reaches the end of a
> function. In fact the same is true of PHP and JavaScript, but in those
> languages you can return early just by saying return.
 
> IMO, this is a major limitation of Pascal. I use returns wherever I feel
> like it - if I detect there's nothing more for the function to do, I
> return. Purists object to this; they say you should enter a function at one
> place and leave at one place. Well, that's a point of view. But more often
> that not it just leads to convoluted code in order to achieve that. The one
> time I *had* to use Pascal as that was the only option, I simply put a 999:
> label at the end of the function and did goto 999 wherever I wanted to do a
> return. Simples!

goto was the thing that got on my nerves. Even to this day I hate that word 
with a passion.
 

-- 
David M.


--- End Message ---
--- Begin Message ---
On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:

> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
> > On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:
> > 
> > 
> > >>
> > >>
> > >> BTW - in any of your other computer languages didn't they utilize a
> > >> 'return' statement?  PHP's is no different.
> > >
> > >
> > >
> > > back in  like '85, I learned Pascal that's the only language I learned and
> > > I
>  don't recall if it used return.
> > 
> > 
> > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In
> > Pascal, implicitly, you return when execution reaches the end of a
> > function. In fact the same is true of PHP and JavaScript, but in those
> > languages you can return early just by saying return.
>  
> > IMO, this is a major limitation of Pascal. I use returns wherever I feel
> > like it - if I detect there's nothing more for the function to do, I
> > return. Purists object to this; they say you should enter a function at one
> > place and leave at one place. Well, that's a point of view. But more often
> > that not it just leads to convoluted code in order to achieve that. The one
> > time I *had* to use Pascal as that was the only option, I simply put a 999:
> > label at the end of the function and did goto 999 wherever I wanted to do a
> > return. Simples!
> 
> goto was the thing that got on my nerves. Even to this day I hate that word 
> with a passion.
>  
> 


I think most people do, all but BASIC purists!

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Wed, Oct 10, 2012 at 8:17 PM, David McGlone <da...@dmcentral.net> wrote:
>>
>> BTW - in any of your other computer languages didn't they utilize a
>> 'return' statement?  PHP's is no different.
>
> back in  like '85, I learned Pascal that's the only language I learned and I
> don't recall if it used return.
>
>  --

Pascal does have return, it only has a different name, exit. The
concept is the same.

- Matijn

--- End Message ---
--- Begin Message ---
On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:
>
>> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
>> > On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:
>> >
>> >
>> > >>
>> > >>
>> > >> BTW - in any of your other computer languages didn't they utilize a
>> > >> 'return' statement?  PHP's is no different.
>> > >
>> > >
>> > >
>> > > back in  like '85, I learned Pascal that's the only language I learned 
>> > > and
>> > > I
>>  don't recall if it used return.
>> >
>> >
>> > Mmmm. There's the problem. Pascal doesn't *have* a return statement. In
>> > Pascal, implicitly, you return when execution reaches the end of a
>> > function. In fact the same is true of PHP and JavaScript, but in those
>> > languages you can return early just by saying return.
>>
>> > IMO, this is a major limitation of Pascal. I use returns wherever I feel
>> > like it - if I detect there's nothing more for the function to do, I
>> > return. Purists object to this; they say you should enter a function at one
>> > place and leave at one place. Well, that's a point of view. But more often
>> > that not it just leads to convoluted code in order to achieve that. The one
>> > time I *had* to use Pascal as that was the only option, I simply put a 999:
>> > label at the end of the function and did goto 999 wherever I wanted to do a
>> > return. Simples!
>>
>> goto was the thing that got on my nerves. Even to this day I hate that word
>> with a passion.
>>
>>
>
>
> I think most people do, all but BASIC purists!
>

Not really, goto can safe you a mess. In some situations it's much
easier and cleaner to use something like goto cleanup; at each error
case, instead of duplicating the cleanup code all over again (Closing
sockets, or in languages like C, freeing memory).

- Matijn

--- End Message ---
--- Begin Message ---
On 10 Oct 2012 at 19:53, David McGlone <da...@dmcentral.net> wrote:

> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
>> On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:

>>>> BTW - in any of your other computer languages didn't they utilize a
>>>> 'return' statement?  PHP's is no different.

>>> back in  like '85, I learned Pascal that's the only language I learned and
>>> I don't recall if it used return.

>> Mmmm. There's the problem. Pascal doesn't *have* a return statement. The one
>> time I *had* to use Pascal as that was the only option, I simply put a 999:
>> label at the end of the function and did goto 999 wherever I wanted to do a
>> return. Simples!
>
> goto was the thing that got on my nerves. Even to this day I hate that word
> with a passion.

Hummmm! Apart from what I described above, I haven't needed to use GOTO since I 
stopped writing FORTRAN in 1978.

--
Cheers  --  Tim

--- End Message ---
--- Begin Message ---
On 10/10/2012 2:36 PM, Tim Streater wrote:
On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:


BTW - in any of your other computer languages didn't they utilize a
'return' statement?  PHP's is no different.

back in  like '85, I learned Pascal that's the only language I learned and I
don't recall if it used return.

Mmmm. There's the problem. Pascal doesn't *have* a return statement. In Pascal, 
implicitly, you return when execution reaches the end of a function. In fact 
the same is true of PHP and JavaScript, but in those languages you can return 
early just by saying return.

IMO, this is a major limitation of Pascal. I use returns wherever I feel like 
it - if I detect there's nothing more for the function to do, I return. Purists 
object to this; they say you should enter a function at one place and leave at 
one place. Well, that's a point of view. But more often that not it just leads 
to convoluted code in order to achieve that. The one time I *had* to use Pascal 
as that was the only option, I simply put a 999: label at the end of the 
function and did goto 999 wherever I wanted to do a return. Simples!

--
Cheers  --  Tim

Now you went and gave our OP something else to think about!  :(:(

--- End Message ---
--- Begin Message ---
On 10/10/2012 4:27 PM, Matijn Woudt wrote:
On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:

On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:




BTW - in any of your other computer languages didn't they utilize a
'return' statement?  PHP's is no different.



back in  like '85, I learned Pascal that's the only language I learned and
I
  don't recall if it used return.


Mmmm. There's the problem. Pascal doesn't *have* a return statement. In
Pascal, implicitly, you return when execution reaches the end of a
function. In fact the same is true of PHP and JavaScript, but in those
languages you can return early just by saying return.

IMO, this is a major limitation of Pascal. I use returns wherever I feel
like it - if I detect there's nothing more for the function to do, I
return. Purists object to this; they say you should enter a function at one
place and leave at one place. Well, that's a point of view. But more often
that not it just leads to convoluted code in order to achieve that. The one
time I *had* to use Pascal as that was the only option, I simply put a 999:
label at the end of the function and did goto 999 wherever I wanted to do a
return. Simples!

goto was the thing that got on my nerves. Even to this day I hate that word
with a passion.




I think most people do, all but BASIC purists!


Not really, goto can safe you a mess. In some situations it's much
easier and cleaner to use something like goto cleanup; at each error
case, instead of duplicating the cleanup code all over again (Closing
sockets, or in languages like C, freeing memory).

- Matijn

haven't used a goto or go in 30 years.

--- End Message ---
--- Begin Message ---
On Wed, Oct 10, 2012 at 7:37 PM, Jim Giner <jim.gi...@albanyhandball.com> wrote:
> On 10/10/2012 4:27 PM, Matijn Woudt wrote:
>>
>> On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan
>> <a...@ashleysheridan.co.uk> wrote:
>>>
>>> On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:
>>>
>>>> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
>>>>>
>>>>> On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:
>>>>>
>>>>>
>>>>>>>
>>>>>>>
>>>>>>> BTW - in any of your other computer languages didn't they utilize a
>>>>>>> 'return' statement?  PHP's is no different.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> back in  like '85, I learned Pascal that's the only language I learned
>>>>>> and
>>>>>> I
>>>>
>>>>   don't recall if it used return.
>>>>>
>>>>>
>>>>>
>>>>> Mmmm. There's the problem. Pascal doesn't *have* a return statement. In
>>>>> Pascal, implicitly, you return when execution reaches the end of a
>>>>> function. In fact the same is true of PHP and JavaScript, but in those
>>>>> languages you can return early just by saying return.
>>>>
>>>>
>>>>> IMO, this is a major limitation of Pascal. I use returns wherever I
>>>>> feel
>>>>> like it - if I detect there's nothing more for the function to do, I
>>>>> return. Purists object to this; they say you should enter a function at
>>>>> one
>>>>> place and leave at one place. Well, that's a point of view. But more
>>>>> often
>>>>> that not it just leads to convoluted code in order to achieve that. The
>>>>> one
>>>>> time I *had* to use Pascal as that was the only option, I simply put a
>>>>> 999:
>>>>> label at the end of the function and did goto 999 wherever I wanted to
>>>>> do a
>>>>> return. Simples!
>>>>
>>>>
>>>> goto was the thing that got on my nerves. Even to this day I hate that
>>>> word
>>>> with a passion.
>>>>
>>>>
>>>
>>>
>>> I think most people do, all but BASIC purists!
>>>
>>
>> Not really, goto can safe you a mess. In some situations it's much
>> easier and cleaner to use something like goto cleanup; at each error
>> case, instead of duplicating the cleanup code all over again (Closing
>> sockets, or in languages like C, freeing memory).
>>
>> - Matijn
>>
> haven't used a goto or go in 30 years.
>
>

It's the whence command that will get you every time (aka "comesfrom").

--- End Message ---

Reply via email to