homepage Welcome to WebmasterWorld Guest from 54.163.72.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Local / Foo
Forum Library, Charter, Moderators: incrediBILL & lawman

Foo Forum

    
User, meet PHP. PHP, meet user.
lucy24




msg:4508025
 10:32 pm on Oct 14, 2012 (gmt 0)

#1 It's only a ### missing semicolon! You carry on as if I'd commented-out the whole page.

#2 Can't you reserve $ for string variables like a normal language? You KNOW it's a variable. What else could it be?

#3 OK, so I used parentheses ( ) instead of braces { }. Didn't the IF give you just a teeny bit of a clue what I was getting at?

#4 Just because I said = instead of == is no excuse to play dead. I mean, honestly.

#5 Look, nobody TOLD me the difference between single ' and double " is phonemic in your language. I didn't mean to start a war.

#6 What do you mean, you didn't have any way of telling me that I inadvertently opened my local file directly instead of through MAMP, and there's not a thing wrong with the code I've been fine-tooth-combing for the past hour? Couldn't you at least, I dunno, flash the menu bar or something?

 

SevenCubed




msg:4508726
 2:44 am on Oct 17, 2012 (gmt 0)

When I transitioned from Visual Basic to PHP I really missed the live running of the code where I could step through each line of code one at a time and hold the mouse over a variable to see if it was picking up its intended value. I really liked running a loop of nested nests and watching the iteration fly by before my eyes. I wish PHP had those same capabilities it would make learning it quick and easy. It was a ballet of patterns, oh the joy!

But almost certainly when you learn by trial and error like you are doing those issues will remain etched in your mind and they are unlikely to get the best of you again.

incrediBILL




msg:4508727
 2:48 am on Oct 17, 2012 (gmt 0)

I wish PHP had those same capabilities it would make learning it quick and easy.


PHP is free, you get what you pay for.

GaryK




msg:4508728
 2:52 am on Oct 17, 2012 (gmt 0)

Aren't there several IDEs for PHP that offer debugging, code completion and other features?

graeme_p




msg:4508739
 3:44 am on Oct 17, 2012 (gmt 0)

There are IDEs and static checkers and a lot of tools to fix these problems.

@incrediBILL, free is no excuse. I generally use free software because I prefer it, not because I an stingy. Plenty of free software is preferable (to me, at least) regardless of cost.

PHP is developed by a company that bases its business on giving away PHP for free so they can sell other stuff. If they want people to buy there other stuff they need to make PHP as good as possible.

incrediBILL




msg:4508751
 4:58 am on Oct 17, 2012 (gmt 0)

free is no excuse.


It is in the case of PHP because I certainly wouldn't pay for this buggy designed by committee mess. I only use it because it's free and accept it's limitations as it is what it is.

If I want some big fancy IDE and a pro development platform I head over to MS's website.

graeme_p




msg:4508775
 6:38 am on Oct 17, 2012 (gmt 0)

I do not use PHP much because I agree it is a mess (the only PHP site I have is my Wordpress based blog).

There are perfectly good free fancy IDEs (Eclipse, for example) if you want them.

However, using an inferior platform because it is cheap/free implies that you either hardly use it, or you place a very low value on your time.

On the other hand I use entirely free software which I am very happy with and would not replace with a proprietary equivalent even if you paid me for both my sites (Lighttpd, Python, Django) and desktop (Ubuntu, Firefox, Geany, Chromium... etc.).

In the case of my desktop I wiped Windows (which came pre-installed) in order to replace it with free software. I live in a country where MS (and most software vendors except IBM and Adobe) has a policy of turning a blind eye to piracy, so I would have no qualms about pirating the proprietary stuff if I thought it was better.

For me, reasons to use PHP are cheap hosting and the availability of software - I would much rather develop using Python + Django than PHP, but I would rather use a solution someone else had already developed then develop my own, and most of those are PHP.

lucy24




msg:4509110
 10:50 pm on Oct 17, 2012 (gmt 0)

Gosh. If I'd known everyone was going to bounce straight into Boring Old Poop mode, I would never have posted :)

Is java preferable? Not javascript. The stuff with the beans.

graeme_p




msg:4509192
 4:31 am on Oct 18, 2012 (gmt 0)

Sorry! We take this stuff very seriously around here :)

I never got the hang of Java. I would say choose a language and a framework (unless you like to/must do it all yourself) together.

I use Django and it is very productive and maintainable, its incredibly easy to create the admin, and Python is clean and easy to learn. Then there is Ruby on Rails, several Java frameworks ...

g1smd




msg:4509213
 7:37 am on Oct 18, 2012 (gmt 0)

Java does away with semi-colons on line endings, so you never have to chase your tail on that one.

I find it difficult to swap between PHP and Java and vice versa, but that's probably age related these days.

lucy24




msg:4509742
 8:32 am on Oct 19, 2012 (gmt 0)

Could be worse. The first language I ever learned was Basic. Applesoft, I guess. Stuff they used in the //e. Much later I did FutureBasic.

I don't remember what, if anything, happened at the end of lines. But we all know what was absolutely obligatory at the beginning of every line. They always told you to go by multiples of 10 so you could squeeze in new stuff after the fact.

I think any function that was called by another function also had to be physically located above/before the calling function.

And then there was that business with PEEK and POKE that I never did understand...


If anyone wondered: I have some groups of pages whose content is hand-coded html. But by throwing in a php footer I can make them link to each other, like chapters in a book, without wholesale chaos if I later decide to rearrange the chapters. (I have actually done this a few times. Lord! How tedious.) So I was obliged to dip one toe into the php waters.

SteveWh




msg:4510184
 3:32 pm on Oct 20, 2012 (gmt 0)

For doing what it sounds like you're doing (adding executable code into existing HTML pages), I think PHP is your best and easiest choice supported by all webhosts for free, so forge ahead with it. It's universal and useful, worth knowing.

[If you're looking for a language to replace AppleSoft BASIC to get tasks done on your local PC -- I sold my AppleSoft BASIC user manual on eBay just a few years ago -- I'd suggest Perl as the easiest language to get tasks done quickly and easily, the best language to do the things that people once used the various BASICs for.]

But PHP is quirky and in a number of ways forgiving, so it is very easy to write code that runs just fine and yet does not do what you expected it to. Pay close attention to the PHP manual and its user comments for every function you use, to be alerted to its quirks, and so you can compensate for PHP's sloppiness by writing your own code to be meticulous and avoid ambiguity.

(Forget about Java for this purpose, but, full disclosure, I have forgotten about Java for all purposes and am biased.)

Some specifics:

#1 It's only a ### missing semicolon! You carry on as if I'd commented-out the whole page.

Not having a line end until the semicolon is very handy when it comes to formatting lines for readability.

#2 Can't you reserve $ for string variables like a normal language?

There are no string variables, just variables. A variable can be a string one second and a number the next (or a string interpreted as if it were a number, or a number interpreted as a string).

#3 OK, so I used parentheses ( ) instead of braces { }. Didn't the IF give you just a teeny bit of a clue what I was getting at?

PHP: "What am I, psychic?"

#4 Just because I said = instead of == is no excuse to play dead. I mean, honestly.

Yes, assignment vs. equality test, important distinction inherited from the C language! But for equality test, look at === (three equals!); often it is the best choice, most likely to make the comparison you intend. Also !== .

#6 What do you mean, you didn't have any way of telling me that I inadvertently opened my local file directly instead of through MAMP?

PHP: "If you don't open the file through MAMP, I don't launch, and if I don't launch, I can't do anything, not even complain!"

graeme_p




msg:4510639
 5:09 am on Oct 22, 2012 (gmt 0)

Agreed, if that is what Lucy is trying to do. That said it is not the only choice.

I disagree about Perl. It makes it easy to produce hard to maintain code (so perhaps it is a good replacement for BASIC!), and I cannot see that it has any particular advantages, and there are much nicer to learn and maintain alternatives.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Local / Foo
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved