Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Chief

PHP Learnlolz

Recommended Posts

So, not knowing PHP has been holding me back quite a bit on some of my projects. Now that I'm learning it, I can progress on some of my more awesome websites, and pwn everyone lololol!

 

So, today, 9/3/2010, this is my first bit of php:

<?php
echo "Hello World.";
?>

<?php
echo "This is my first PHP!";
// this is a line comment
/* this
is a comment
block */
?>

<?php
$txt="Hello Variable!";
$x=16;
?>
<br />
<?php
echo $txt;
?>

Doesn't do much, only shows some text. But, Its pretty dang easy!

 

edit, here's more!

<br />
<?php
echo strlen("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
?>
<br />
<?php
echo $x+3;
?>
<br />
<?php
if($d=="Fri")echo"Have a nice lulz weekend!";
if($m=="Sep")echo"SEPTEMBER!";
if($y=="2010")echo"The Year is 2010";
?>
<br />
Today's date is
<?php
echo $d;
echo ", ";
echo $m;
echo "/";
echo $n;
echo "/";
echo $y;
?>

 

this is what all of that looks like:

Hello World. This is my first PHP!

Hello Variable!

26

19

Have a nice lulz weekend!The Year is 2010

Today's date is Fri, 09/03/2010

Edited by Chief

Share this post


Link to post
Share on other sites

: o

 

 

Pretty cool, matie.

 

Now let's see you make something awesome for our site. :P

 

What are you learning PHP with? Any books in particular?

Share this post


Link to post
Share on other sites

No book, just w3schools.com

 

That's cool. I used that website to learn HTML. I'm not fully good at it but I know a few things. :biggrin_002:

Share this post


Link to post
Share on other sites

I quickly gave up on w3schools, the exact tuts you're doing, but I occasionally use the site for reference.

 

I like messing with Php and MySQL.

 

Try this doing this, without trying to comprehend what it does:

<?php
$y=0;
while($x == $x)
{
$y++;
echo $y.'<Br />';	
}
?>

Share this post


Link to post
Share on other sites

you poop face... I tried to figure out what it did, and all I could come up with is that it made something increase via "$y++"... almost crashed my browser, lol

Share this post


Link to post
Share on other sites

Hehe. Mine almost crashed at around 50,000. :)

 

The ++ thingy is pretty useful though. Its common to see $counter=0 followed by a while loop containing $counter++. You know how the news system on the homepage has the avatar on the left, then right, the left etc. That's partly how its done. Another use is the ranks created in the Hall of Fame.

 

I'll try think of another way to crash your browser :)

Share this post


Link to post
Share on other sites

you should post some of your useful snippets so I can learn with some logical code that actual does things, lol

Share this post


Link to post
Share on other sites

Just stop. W3Schools is great for learning HTML. But if you really want to learn PHP learn PHP OOP.

Share this post


Link to post
Share on other sites

I'm pretty sure you need to know PHP before doing it in OOP. I didn't quite get far enough to learn it but I know its objects and classes and things.

 

I was going to begin OOP on my exam tracker website on your hosting service Clone, but for some reason it does not seem to be working. But that's another issue. I would like to continue using the hosting service if possible however.

 

Anyway, here's a nice little tutorial on OOP, when you're ready of course Chief: http://www.webdevrefinery.com/forums/topic/2525-getting-started-with-object-oriented-php/

Share this post


Link to post
Share on other sites

Just stop. W3Schools is great for learning HTML. But if you really want to learn PHP learn PHP OOP.

 

gtfo, lulz. w3schools is great for everything. I'ma continue to use it regardless of your irrelevant advice. I don't even know what OOP is. Marked just said you needed to know PHP before OOP anyways. hrmmph.

Share this post


Link to post
Share on other sites

Good luck chief

scripting was way to complicated for me, i might give it another go later though.

I learn abit of HTML at school and i found it easy :sweatdrop: but forgot most of it now

PHP seems deathly hard looking at the code posted here and OOP just looks like a beggining of OOPS for me

Share this post


Link to post
Share on other sites

lmao. I went to the website in Marked's post. When I went to the homepage, it said this:

Join us to become a better dev.

Or leave, and you'll suck at web code.

My mom left and she can't make a website for beans.

True story.

 

lol.

Sorry to be off topic.

Share this post


Link to post
Share on other sites
I'ma continue to use it regardless of your irrelevant advice.

He was just giving you advice.. its not necessarily irrelevant.

 

@rgangsta: that site has some excellent coders on it. All my topics get answered and pretty quickly too.

 

Anyway Chief. I'm thinking about writing a tutorial, one that covers basically how to create a recent posts module/hook as on our homepage and forums index. It's main emphasis will be PHP and MySQL. What do you think?

Share this post


Link to post
Share on other sites

I have started, but it will take some time to write up I think. I have constructed a sample database and just started writing the first steps of the tut. I'll try and finish it today, but no promises.

 

EDIT: http://www.rmxpunlimited.net/forums/topic/5581-creating-a-recent-posts-modul/

 

Goodluck with it, not sure who you will go. You may want to save it for later or something...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...