[HELP] Learning PHP
#1

I've decided to try and learn PHP once again, as my brain just switches off, I get distracted by other things (you already know what), I wish to learn, as I would like to design my site, or aid a PHP coder in creating it with me. Does anyone recommend a certain method of learning it?
Reply
#2

I hate php, but I learn as I go. A good website to learn through is:
http://www.w3schools.com/default.asp
Then what I sometimes do is go through to an example and erase the code and put my own. But it doesn't work for php as it requires a re-direct to the php page for it to work..
Reply
#3

Quote:
Originally Posted by Runedog48
View Post
I hate php, but I learn as I go. A good website to learn through is:
http://www.w3schools.com/default.asp
Then what I sometimes do is go through to an example and erase the code and put my own. But it doesn't work for php as it requires a re-direct to the php page for it to work..
Yeah. I used w3 to learn HTML (basic coding I know but hey, it looks ok on your CV!). Thanks for the reply anyway.
Reply
#4

I've recently been trying to learn PHP as well, so far it's turning out great. You just have to stay focused, follow the tutorials and you'll be fine.
Reply
#5

Quote:
Originally Posted by Steven82
View Post
I've recently been trying to learn PHP as well, so far it's turning out great. You just have to stay focused, follow the tutorials and you'll be fine.
Thanks. I'm trying my best. This is like the 3rd/5th time trying to learn PHP, I'm learning it to build my first PHP site, edit my friends forum (TinyBB) and make myself a control panel for my Linux VPS.
Reply
#6

How can I view my PHP file without uploading it to a site?
Reply
#7

Quote:
Originally Posted by FC-RP
View Post
How can I view my PHP file without uploading it to a site?
Scratch that. Figured it out. If you look at "http://domigraph.netne.net/" (my PHP project site). The tutorial asks you to input a variable
Code:
$var_name=value;
I do not understand variables. Can anyone help?
Reply
#8

Quote:
Originally Posted by FC-RP
View Post
How can I view my PHP file without uploading it to a site?
just install xampp and start it's apache service at first
if you want to use mysql later you can start the mysql service too
then you can access that through you localhost

so you just put in your url localhost and it redirects you the the xampp example page on your pc
in htdocs(in your xamppfolder[in C:\]) you can delete all the sample files or move them in an own folder and
then you can put your php stuff there


To the vriable problem:
You are Probably putting it out this way
echo 'Hello! This is a test script! $var_name=value;';

but it should be

echo 'Hello! This is a test script!'.$var_name=value;

if not just show us the piece of code^^
Reply
#9

PHP is not that hard, PM me I can help you with anything you need.
I would call it easier than pawn.
Reply
#10

Yes.

1) You can't assign value to var outside of php tags (<?php ?>).
2) It would be $var_name="value"; if string.
Reply
#11

Quote:
Originally Posted by ћNJ
Посмотреть сообщение
Yes.

1) You can't assign value to var outside of php tags (<?php ?>).
2) It would be $var_name="value"; if string.
AH! I see now, thanks for the help.

Could you explain variables a bit more to me please?
Reply
#12

Quote:
Originally Posted by FC-RP
Посмотреть сообщение
AH! I see now, thanks for the help.

Could you explain variables a bit more to me please?
You are better off searching for tutorials on ******.

Go to this site for a tut on variables: http://www.tizag.com/phpT/variable.php

That same site provides more PHP tutorials and It's a great website to start learning from!
Reply
#13

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
You are better off searching for tutorials on ******.

Go to this site for a tut on variables: http://www.tizag.com/phpT/variable.php

That same site provides more PHP tutorials and It's a great website to start learning from!
Thanks.
Reply
#14

$x=200 you forgot a ; here

PHP код:
$x=200
and what is $var_name=value; ?

value is not declared ?

Edit: oh, didnt notice the other comments, silly me ^^
Reply
#15

There are plenty of tutorials available by doing a simple search, people here aren't going to spoonfeed you php..
Reply
#16

Here is a simple bit of PHP for you to ponder over.

PHP код:
trait Block
{
        public
                
$hello null,
                
$sMessage "well hello there";
        public function 
test()
        {
                echo 
"well done, it works";
        }
}
class 
Something
{
        use
                
Block;
        public function 
__construct()
        {
                
$this->hello = function()
                {
                        return array(
$this->sMessage);
                };
        }
}
$p = new Something();
echo 
$p->hello()[0]; 
Reply
#17

Quote:
Originally Posted by Westie
Посмотреть сообщение
Here is a simple bit of PHP for you to ponder over.
I'm glad to see someone else excited over the array dereferencing and trait support in PHP 5.4, too bad they just started the alpha for it.
Reply
#18

I am by far not an expert in PHP but what helped me begin is watching and reviewing some tutorials and also editing some codes.

Hope it helps.
Reply
#19

Here is a small script with some variables etc.

PHP код:
<?php
    $title 
"PHP Test";
    
$showPage = isset($_GET['showpage']) ? true false;
    
$pageLine1 "Welcome to this site!";
    
$pageLine2 "This is just some text. Let's call this famous text: \"Hello world!\"";
?>
<html>
  <head>
    <title><?php echo $title?></title>
  </head>
  <body>
<?php
    
if($showPage):
        echo 
$pageLine1 '<br />' $pageLine2;
    else: echo 
"The page won't be showed :P";
    endif;
?>
  </body>
</html>
Demo: http://rl-rp.com/test.php
First try that link, then: http://rl-rp.com/test.php?showpage

As you have noticed maybe, I used:

statement :
//operation
endif;

instead of

statement {
// operation
}

I prefer that
Reply
#20

Quote:
Originally Posted by FC-RP
View Post
Yeah. I used w3 to learn HTML (basic coding I know but hey, it looks ok on your CV!). Thanks for the reply anyway.
I did that with PHP, C++, VB Legacy, and VB .NET. It really surprised them that i took the time to learn it on my own.

I started PHP with GD, the graphics library. I do not recommend it! I do recommend tinkering! just start playing with things. Its not very difficult for basics.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)