38 replies
Ok Well I am new hear but I have been doing programming for over 10 years.
I have been seeing a lot of post about learning php So I'll give some basics of php.

first you need a file called for example "index.php"
know for the php file to work you need to put this into it
PHP Code:
<?php

?>
so thats how you start your php file.

Ok Know we are going to make a basic call in your php file.
To start a basic syntax call it starts with $ sign. to enclose your value you can either use ' ' or " " know lets say your value text is hello it's me we in the word it's has a ' to void that value out you put \ this in front of ' this.
Know at the end of your syntax it has to have this ;
To print this value out you can either use print or echo to show your value out.
PHP Code:
<?php

$hello 
'hello it\'s me';
echo 
$hello;
print 
$hello;
?>
Ok so there is a very basic start.
So lets say you want to add a comment in your php file so you can come back to the file and read of what you doing you put this in front of your comment // for example.

PHP Code:
<?php
// this is how to print out our syntax
$hello 'hello it\'s me';
echo 
$hello;
print 
$hello;
?>
Know lets say you have two strings you want to print out in one line this is how you do it. I like to make a new string that combines the 2 values.
So when you combine them after the fist value your going to want to put this behind it . yes the period.
PHP Code:
<?php
// this is how to print out our syntax
$name ' and my name is joe';
$hello 'hello it\'s me';
$hello_name $hello.$name;
print 
$hello_name;
?>
So lets say you want to have a break in the value so it would print out like this
hello it's me
and my name is joe
your syntax would look like this you can see after the . we wrapped some html code in it to break it and inclosed with " " and after that we put another . so thats how we do that
PHP Code:
<?php
// this is how to print out our syntax
$name 'and my name is joe';
$hello 'hello it\'s me';
$hello_name $hello."<br>".$name;
print 
$hello_name;
?>
Ok wel lets say that if value of some syntax is ted or joe and you want to print out the right value we can do this with the if statement. know the if statement looks like this
PHP Code:
if(){


In these () is where your going want to put the value that either is equal or not equal to the value equal value is == not equal is =! so lets say value $a == '1' or in word terms this says $a is equal to 1. $a =! '1' word terms this says $a is not equal to 1.

this how it would look in the if statement
the equal
PHP Code:
if($a == '1'){


the not equal
PHP Code:
if($a =! '1'){


Know you see { } these that where you are going to put the data of what you want to show if the value is either equal or not equal.
PHP Code:
<?php
$a 
'1';
if(
$a == '1'){
$b 'what i want to print if $a is equal to 1';
}
print 
$b;
?>
lets put this in our hello php file

PHP Code:
<?php
// this is how to print out our syntax
$diff_name 'ted';
if(
$diff_name == 'ted'){
    
$user ='Ted';
}
if(
$diff_name == 'joe'){
    
$user ='Joe';
}

$name 'and my name is '.$user;
$hello 'hello it\'s me';
$hello_name $hello."<br>".$name;
print 
$hello_name;
?>
So I hopping your getting it so far

Know with the if statement you can have a else statement with it .
What that means in word terms is this if $a is not equal to 1 else use the other option.
so the php code would look like this
PHP Code:
<?php
$a 
'1';
if(
$a == '1'){
$b 'what i want to print if $a is equal to 1';
}else{
$b 'what i want to print if $a is not equal to 1';
}
print 
$b;
?>
You can also have a if elseif else Statement

hear is a example:
PHP Code:
<?php
// this is how to print out our syntax
$diff_name 'ted';
if (
$diff_name == 'ted'){
  
$user ='Ted';
  } elseif (
$diff_name == 'joe'){
  
$user ='Joe';
  }else{
  
$user ='Noname';
  }
$name 'and my name is '.$user;
$hello 'hello it\'s me';
$hello_name $hello."<br>".$name;
print 
$hello_name;
?>
There is also another way you can do this Its called a switch where you add more values with out it becoming a head ache.So to call the switch it switch know case is the value you want it equal to break means it goes to the next one to find if equal to. You have a default if none of the values are equal to any of the case. So hear is a example of it

PHP Code:
<?php
// this is how to print out our syntax
$diff_name 'ted';
switch (
$diff_name){
case 
'ted':
  
$user ='Ted';
  break;
case 
'joe':
  
$user ='Joe';
  break;
case 
'erica':
  
$user ='Erica';
  break;
default:
  
$user ='Noname';
}
$name 'and my name is '.$user;
$hello 'hello it\'s me';
$hello_name $hello."<br>".$name;
print 
$hello_name;
?>
There some basics of php I hope that this helps
#basics #php
  • {{ DiscussionBoard.errors[6532416].message }}
  • Profile picture of the author anna14
    Such a good explanation for beginners
    {{ DiscussionBoard.errors[6532496].message }}
  • Profile picture of the author teguhyuliantos
    Thanks for share your knowledge. I am very interested to learn more about PHP. Its very useful for PHP beginner.
    {{ DiscussionBoard.errors[6532580].message }}
    • Profile picture of the author jiffyspop
      hey thank you I'll make more post on this and go into more detail about programming like function and classes I hope this helps alot of peps
      {{ DiscussionBoard.errors[6533385].message }}
  • Profile picture of the author OrlandoBloom
    Your information is very useful for human beings. Thanks for the nice information.
    {{ DiscussionBoard.errors[6539751].message }}
  • Profile picture of the author rising_sun
    Banned
    Pretty good job.I love PHP by this perspective I can say ,your explanation is very effective for the beginner.Yuo can follow the book "beginner php 5-by wrox".I think it can strong your basic.
    {{ DiscussionBoard.errors[6540826].message }}
  • Profile picture of the author cutegirl36
    If you use php, you should have php manual
    Signature

    Source: friv

    {{ DiscussionBoard.errors[6544767].message }}
  • Profile picture of the author advocatekabir
    IF you want to really learn to PHP go on w3schools.com that is the perfect way to learn PHP.
    {{ DiscussionBoard.errors[6551812].message }}
  • Profile picture of the author dylanrodriguez2012
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[6552250].message }}
    • Profile picture of the author phpguy900
      Hey Friends this is my first post here but i want to share a resource which really helped me in learning php basics, hope it helps every newbie...
      thenewboston . org
      phpacademy .org

      as i am newbie so cant post link so just type it manually..
      i know this is gonna help everyone who is willing to learn php himself.

      Originally Posted by dylanrodriguez2012 View Post

      Hello Guys.

      If you want to a php tutorials, go w3school tutorials because this is a very simple tutorials for learn php.

      All your comment for php development and asp.net development are welcome.

      Thanks in advance.
      {{ DiscussionBoard.errors[6552705].message }}
  • Profile picture of the author kaizen
    Go to youtube and search phpacademy channel. I learn much about php there.
    {{ DiscussionBoard.errors[6554624].message }}
    • Profile picture of the author madelinekim
      PHP is a scripting language and many times used with HTML to compose functions that HTML absence. Any one who knows the basic of this programming language can easily learn the PHP.
      {{ DiscussionBoard.errors[6558855].message }}
  • Profile picture of the author Mr Bill
    Thanks Jiffy! I've used PHP but never knew the how and why. You may have prompted me to head off to "school" to learn it. Thanks also to Kaizen for the YouTube link.
    {{ DiscussionBoard.errors[6563581].message }}
  • Profile picture of the author James Andy
    I think it is good for all especially beginners they should see and learn from this post. Keep it up dear!
    {{ DiscussionBoard.errors[6580231].message }}
  • Profile picture of the author John Ayling
    Very handy stuff for beginners. Especially those who are blindly struggling with filling out php templates for mobile sites.
    Signature
    Software Marketing & Licensing System for WordPress Plugins, Themes & .NET Software
    >> 72 Hour Special <<
    {{ DiscussionBoard.errors[6580503].message }}
    • Profile picture of the author Carl Potts
      I'd recommend the Larry Ullman PHP books
      {{ DiscussionBoard.errors[6580542].message }}
  • Profile picture of the author weaveronline
    nice job
    Signature

    Thanks & Regards,
    Reach us at dukeduke600@gmail.com.
    Web Design| Logo Design | Banner Design | Web Development | Mobile Applications [iPhone/iPad/Android/Windows Phone]

    {{ DiscussionBoard.errors[6580546].message }}
  • Profile picture of the author jaasmit
    This is really awesome. You have really done a good job. Specially for the newbies who are interested in learning php to develop their web development skill.
    {{ DiscussionBoard.errors[6611638].message }}
    • Profile picture of the author annahussy
      You did fabulous job to giving me such a good information. That is as useful as important for all newbies. Who want to make them carrier on PHP? Thanks for your suggestion.
      {{ DiscussionBoard.errors[6615423].message }}
  • Profile picture of the author avjy27
    really good informative thanks to share.......
    {{ DiscussionBoard.errors[6615713].message }}
  • {{ DiscussionBoard.errors[6616302].message }}
  • Profile picture of the author michaelh73
    Great stuff. And if your trying to learn php on your own computer locally it might help to get xampp to be able to write locally on your computer.
    {{ DiscussionBoard.errors[6619080].message }}
  • Profile picture of the author sham2
    You are done great job jiffyspop.These are the basic steps of php for beginner. I like your post very much..,I want to share some popular site of php learning W3Schools Online Web Tutorials , PHP Tutorial - Introduction and PHP: Hypertext Preprocessor are the best web site for learning php ..When you visit these sites you will learn soon php basic and much more about php..
    best regards ....
    sham
    {{ DiscussionBoard.errors[6628442].message }}
  • Profile picture of the author genanovlis
    Decent, now lets advance everyone from basic PHP to basic Symfony.
    {{ DiscussionBoard.errors[6628488].message }}
  • Profile picture of the author icando
    I have designed some Websites with php for myself and my customers,PHP is a flexible and easy to learn programming language.
    {{ DiscussionBoard.errors[6628981].message }}
    • Profile picture of the author Bernardcwood
      PHP is probably the most popular programming language on the web. Used to improve the website. With PHP, you can do things like create username and password pages, check details of a form, create forums, photo galleries, polls, and more. If you come across a website that ends in PHP, then the author has written some programming code to encourage plain, old HTML.
      {{ DiscussionBoard.errors[6629831].message }}
    • Profile picture of the author jasonallvall
      Originally Posted by icando View Post

      I have designed some Websites with php for myself and my customers,PHP is a flexible and easy to learn programming language.
      i agree with you
      {{ DiscussionBoard.errors[6633645].message }}
  • Profile picture of the author jasonallvall
    thank you for this thread
    {{ DiscussionBoard.errors[6633643].message }}
  • Profile picture of the author HowardBeck
    Really,it's good explanation of programming language .You are share nice and useful tutorial from other site are not provide.
    {{ DiscussionBoard.errors[6635404].message }}
  • Profile picture of the author jaasmit
    Seems like people are really having a good time to get this helpful post from you. You really should carry on posting like this.
    {{ DiscussionBoard.errors[6637662].message }}
  • Profile picture of the author Simon Marco
    I am looking to start the programming but not getting what i have to do. I got your post it is a helping hand . Thanks i hope to read more about the php programming .
    {{ DiscussionBoard.errors[6652193].message }}
  • Profile picture of the author mmrumii
    I'm really interested to PHP and I'm really happy to see this thread.
    Thanks for your kinda help. As a beginner , It's really important for mine.
    I have enjoy this one.
    {{ DiscussionBoard.errors[6674718].message }}
  • Profile picture of the author ubaid12j
    Hmm, for me this tutorial is a kid play.
    {{ DiscussionBoard.errors[6688093].message }}
  • Profile picture of the author dmg68
    I'm trying to learn php, thanks for your post
    {{ DiscussionBoard.errors[6688111].message }}
  • Profile picture of the author bhushan@rancor
    Awesome info seems, I am not from this but it has good feeling to me by seeing this.
    thanks for sharing this awesome one.
    Signature
    Interactive Bees Pvt Ltd best known for Quality Web Development Solutions and Online Marketing Services.
    {{ DiscussionBoard.errors[6688126].message }}
  • Profile picture of the author juliarose
    Thank you for sharing.
    {{ DiscussionBoard.errors[6688177].message }}
  • Profile picture of the author davidc1
    fine short course for a beginner
    {{ DiscussionBoard.errors[6689383].message }}
  • Profile picture of the author Nauman K
    Nice one..
    W3schools.com is the best place to start, but I would recomend to have basic knowledge of html/css before moving to php.
    {{ DiscussionBoard.errors[6689758].message }}
    • Profile picture of the author DeskCoder
      Originally Posted by Nauman K View Post

      Nice one..
      W3schools.com is the best place to start, but I would recomend to have basic knowledge of html/css before moving to php.
      Be careful when using W3 Schools:
      W3Fools

      They have a lot of WRONG content on their site.
      {{ DiscussionBoard.errors[6690381].message }}

Trending Topics