Learning PHP
-
Now that I have a NOOK, I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind. I downloaded an ebook, "I Hate PHP: A Beginner's Guide to PHP and MySQL", which is the most terrible book I've ever spent money on. Makes sense, since it was like $4. I still haven't installed an IDE (though I downloaded NetBeans), but from what I've read I'd say PHP is like a server side version of JavaScript and whatever "language" you use with the command prompt. It appears that variables are not strongly typed and the use of strings in variables is weird (if the crappy ebook I bought is to be trusted):
$str1 = "hello";
$str2 = "world";
echo "$str1 $str2";
// This is a comment.And this is a comment too? WTF.
Feels dirty to use variables in a string like that and have them be not be treated as literals. Kinda nifty though. In any event, I'm happy I'm learning PHP. It will give me something to hate much more than VB.NET. :rolleyes:
ultraedit or ultrastudio will do you well as an IDE for PHP PHP is a loosely typed language ... the strings in variables thing is because PHP has a greedy tokenizer that will see anything after a $ sign as a variable name ... if you put your strings in single quotes you get strings as you know them instead PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve if you go into it with an open mind you might find it quite nice oh yeah.. since you are learning from scratch do yourself a favor and go get TinyButStrong (*very* odd name) ... a wicked good template engine that lets you have code behind files just like .NET and keeps things *much* tidier when you get larger projects hth :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
I began learning PHP this January. It is an ugly language, which totally makes sense because it was never actually designed. But it helps me get things done faster than C++ (my favorite language), .NET or (God forbid!) Java, so I guess I cannot complain. IMHO, the best PHP IDE is Notepad++. Yes, it is not actually an IDE. Script languages are not suited to IDEs. And, actually, JavaScript is a nice language. I basically love its logical operators. Unless your users use Internet Explorer, in which case JavaScript is basically the spawn of the devil. --- EDIT: Oh, and also, the best way to use in-string variables is the following:
echo "{$str1} {$str2}";
echo "{$obj->member1} {$obj->member2}";Notepad++ will even nicely highlight
{$var}
and{$obj->var}
with a different color than the rest of the string.Eduardo León
very good :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
There are lots of languages out there like that, I've yet to meet one that wasn't evil. I wrote a PHP website for some friends, their budget was tiny, so I got free hosting (lots for PHP). I needed a good long shower after I finished, but there is a spot of dirt on my hand I can't quite get rid of.
Sort of a cross between Lawrence of Arabia and Dilbert.[^]
-Or-
A Dead ringer for Kate Winslett[^]funny... i feel the exact same way about .NET
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
funny... i feel the exact same way about .NET
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
I love .NET, but recent PHP work is leaving me feeling quite dirty.
-
Now that I have a NOOK, I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind. I downloaded an ebook, "I Hate PHP: A Beginner's Guide to PHP and MySQL", which is the most terrible book I've ever spent money on. Makes sense, since it was like $4. I still haven't installed an IDE (though I downloaded NetBeans), but from what I've read I'd say PHP is like a server side version of JavaScript and whatever "language" you use with the command prompt. It appears that variables are not strongly typed and the use of strings in variables is weird (if the crappy ebook I bought is to be trusted):
$str1 = "hello";
$str2 = "world";
echo "$str1 $str2";
// This is a comment.And this is a comment too? WTF.
Feels dirty to use variables in a string like that and have them be not be treated as literals. Kinda nifty though. In any event, I'm happy I'm learning PHP. It will give me something to hate much more than VB.NET. :rolleyes:
I kinda liked the Zend IDE a couple of years back. Never head big problems with php, it's not really fit to build huge abstraction layers and such, but in a web browser you are already very limited in what you can do, and php nicely reflects that.
Wout
-
I love .NET, but recent PHP work is leaving me feeling quite dirty.
shame
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
ultraedit or ultrastudio will do you well as an IDE for PHP PHP is a loosely typed language ... the strings in variables thing is because PHP has a greedy tokenizer that will see anything after a $ sign as a variable name ... if you put your strings in single quotes you get strings as you know them instead PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve if you go into it with an open mind you might find it quite nice oh yeah.. since you are learning from scratch do yourself a favor and go get TinyButStrong (*very* odd name) ... a wicked good template engine that lets you have code behind files just like .NET and keeps things *much* tidier when you get larger projects hth :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
l a u r e n wrote:
code behind files just like .NET
I hope it's not actually code behind files like .net, because those are pretty awful. Have you looked at MVC and Razor? I've only played around with it a little bit, but it seems nice. I think someone finally realized that java wasn't the target anymore, and needed something easy to use and learn to counter things like PHP and Ruby.
Curvature of the Mind now with 3D
-
l a u r e n wrote:
code behind files just like .NET
I hope it's not actually code behind files like .net, because those are pretty awful. Have you looked at MVC and Razor? I've only played around with it a little bit, but it seems nice. I think someone finally realized that java wasn't the target anymore, and needed something easy to use and learn to counter things like PHP and Ruby.
Curvature of the Mind now with 3D
not it isn't code behind in the same sense as .NET but it gives a seperation of presentation and code in the same way ... i used code behind as a familiar term for a .NET dev to get the basic idea :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
Now that I have a NOOK, I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind. I downloaded an ebook, "I Hate PHP: A Beginner's Guide to PHP and MySQL", which is the most terrible book I've ever spent money on. Makes sense, since it was like $4. I still haven't installed an IDE (though I downloaded NetBeans), but from what I've read I'd say PHP is like a server side version of JavaScript and whatever "language" you use with the command prompt. It appears that variables are not strongly typed and the use of strings in variables is weird (if the crappy ebook I bought is to be trusted):
$str1 = "hello";
$str2 = "world";
echo "$str1 $str2";
// This is a comment.And this is a comment too? WTF.
Feels dirty to use variables in a string like that and have them be not be treated as literals. Kinda nifty though. In any event, I'm happy I'm learning PHP. It will give me something to hate much more than VB.NET. :rolleyes:
AspDotNetDev wrote:
I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind.
Seriously, why? It won't improve your career - PHP jobs are less paid and more outsourced than .NET ones. It will not expand your horizons and make you a better programmer either. If you are into new "web languages", better look at Ruby.
-
Now that I have a NOOK, I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind. I downloaded an ebook, "I Hate PHP: A Beginner's Guide to PHP and MySQL", which is the most terrible book I've ever spent money on. Makes sense, since it was like $4. I still haven't installed an IDE (though I downloaded NetBeans), but from what I've read I'd say PHP is like a server side version of JavaScript and whatever "language" you use with the command prompt. It appears that variables are not strongly typed and the use of strings in variables is weird (if the crappy ebook I bought is to be trusted):
$str1 = "hello";
$str2 = "world";
echo "$str1 $str2";
// This is a comment.And this is a comment too? WTF.
Feels dirty to use variables in a string like that and have them be not be treated as literals. Kinda nifty though. In any event, I'm happy I'm learning PHP. It will give me something to hate much more than VB.NET. :rolleyes:
It is good to broaden your scope into other languages and scripting. The more you know the better work you will get. Also some people may say php is not in use or payed very well, it is completely a lie, hell look at facebook uses it, then compiles it down to c. With your strings above just remember to always use them the following way. $str1 = 'hello'; $str2 = 'world'; echo "$str1 $str2"; Single quotes do not invoke variable replacing and are a lot faster. Also something kool is when you get into replacing ids in arrays.
"I do not know with what weapons World War 3 will be fought, but World War 4 will be fought with sticks and stones." Einstein "Few things are harder to put up with than the annoyance of a good example." Mark Twain
-
AspDotNetDev wrote:
I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind.
Seriously, why? It won't improve your career - PHP jobs are less paid and more outsourced than .NET ones. It will not expand your horizons and make you a better programmer either. If you are into new "web languages", better look at Ruby.
Nemanja Trifunovic wrote:
why? It won't improve your career
It's a new skill (and I love learning), and it may help me do things that I couldn't do before. For example, MediaWiki plugins are written in PHP, so I can now create plugins for the most popular wiki software in the world. That would have been useful at my last company, as we had an installation of MediaWiki we all used.
-
I've never really wanted to learn PHP: every time I look at a "code" sample, I am reminded of GWBasic, shudder, and look away again, quickly...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
I learned programming with QuickBasic, so any reminder of that time would be both nostalgic and horrific. :)
-
ultraedit or ultrastudio will do you well as an IDE for PHP PHP is a loosely typed language ... the strings in variables thing is because PHP has a greedy tokenizer that will see anything after a $ sign as a variable name ... if you put your strings in single quotes you get strings as you know them instead PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve if you go into it with an open mind you might find it quite nice oh yeah.. since you are learning from scratch do yourself a favor and go get TinyButStrong (*very* odd name) ... a wicked good template engine that lets you have code behind files just like .NET and keeps things *much* tidier when you get larger projects hth :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
Wait until you discover global variables! :sigh:
[www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.
I just used my first reference variable in a calendar I was working on, and it works... I'm not sure why it works because from everything I learned in C that variable shouldn't exist when I'm using it but for some reason it's still there. It's a bit messed up, but once you get the hang of it, it's not too bad. On a side note, IE seems to hate PHP as I can have a form looking great in Chrome, FireFox and Safari, look at it in IE 6 or 8 and the formatting is all over the place so good luck there as well... Did I mention I hate web programming (but it pays the bills) :laugh:
-
AspDotNetDev wrote:
I decided to learn a new programming language on a whim. For some reason, PHP was the first thing that came to mind.
Seriously, why? It won't improve your career - PHP jobs are less paid and more outsourced than .NET ones. It will not expand your horizons and make you a better programmer either. If you are into new "web languages", better look at Ruby.
-
I just used my first reference variable in a calendar I was working on, and it works... I'm not sure why it works because from everything I learned in C that variable shouldn't exist when I'm using it but for some reason it's still there. It's a bit messed up, but once you get the hang of it, it's not too bad. On a side note, IE seems to hate PHP as I can have a form looking great in Chrome, FireFox and Safari, look at it in IE 6 or 8 and the formatting is all over the place so good luck there as well... Did I mention I hate web programming (but it pays the bills) :laugh:
MacRaider4 wrote:
Did I mention I hate web programming (but it pays the bills)
Heh ... funny, seems like no one will admit how bad web programming is. Fortunately I don't have to pay the bills doing that! I've worked with it only enough to realize that, ugh ... I don't wanna do that! -Max :D
-
ultraedit or ultrastudio will do you well as an IDE for PHP PHP is a loosely typed language ... the strings in variables thing is because PHP has a greedy tokenizer that will see anything after a $ sign as a variable name ... if you put your strings in single quotes you get strings as you know them instead PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve if you go into it with an open mind you might find it quite nice oh yeah.. since you are learning from scratch do yourself a favor and go get TinyButStrong (*very* odd name) ... a wicked good template engine that lets you have code behind files just like .NET and keeps things *much* tidier when you get larger projects hth :)
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
For PHP and Web I like Aptana - its eclipse based, and has a very nice little JS server for testing (Jaxer).
l a u r e n wrote:
PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve
"One lets you create defects real fast and the other lets you execute defects real fast" :laugh: All risible commentary aside, Use PHP for rapid feature development, then use C# to provide the bones the PHP meat sits on. Now go wash your hands and don't talk about it :omg:
Nothing is impossible, we just don't know the way of it yet.
-
For PHP and Web I like Aptana - its eclipse based, and has a very nice little JS server for testing (Jaxer).
l a u r e n wrote:
PHP is a far superior web scripting language, in my experience, to c# *depending* on what you are trying to achieve
"One lets you create defects real fast and the other lets you execute defects real fast" :laugh: All risible commentary aside, Use PHP for rapid feature development, then use C# to provide the bones the PHP meat sits on. Now go wash your hands and don't talk about it :omg:
Nothing is impossible, we just don't know the way of it yet.
LimeyRedneck wrote:
All risible commentary aside, Use PHP for rapid feature development, then use C# to provide the bones the PHP meat sits on.
:laugh: :laugh: :laugh: you *are* joking right?
"mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"
-
I've never really wanted to learn PHP: every time I look at a "code" sample, I am reminded of GWBasic, shudder, and look away again, quickly...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
Funny. Zuckerberg has built a multi-billion dollar business using PHP (Facebook). Just sayin... :laugh:
Funny indeed: Bill Gates started Microsoft by writing a BASIC interpreter for the Altair. I think he has made a few bucks on that, as well...still doesn't mean I want to code in it! (Or go anywhere near ArseBook) :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."