Friday, November 30, 2012

Learning PHP - While Loop & Post Increment

While Loop


Execute the statement repeatedly while the expression or condition is TRUE.

syntax:

while (expression)
statement


Post Increment

example: a++  ( Returns a, then increments a by one )


Sample Program:


Used HTML tag
to insert a single line break.

Every loop, the value of $a increments and printed on the next line.

Output:

Learning PHP - Else . . . Else If

Learning PHP - Assignment, Comparison and If


Friday, November 16, 2012

Learning PHP - Else . . . Else If


Else

- executes a different statement only if the condition of if statement is FALSE


Else If

- executes a different statement if the condition of if statement is FALSE and only if the else if
   conditional expression is TRUE


       Else Program Sample:




                                     Output: ( prints the value of $b )




        Else If Program Sample:



                                     Output: ( prints the value of $c )




Wednesday, November 14, 2012

Learning PHP - Assignment, Comparison and If

Assignment Operator

In PHP, " = " does not mean equal. It assigns the value from the right of the expression to the left operand.

example: $a = 1000  $a gets set to 1000 ( the value of "$a = 1000" is 1000 )


Comparison Operator

If you want to use equal, this is the operator: = =

example: $a = = $b  ( TRUE if $a is equal to $b )



If Statement

Syntax:  if ( expression or condition )
          statement

If  condition is TRUE, statement will be executed. If condition is FALSE, statement will be ignored.
 
example:

             //This will print the value of $a on the screen if $a is equal to $b.

              if ( $a = = $b );
              print $a ;

     

              Sample Program:



                Output:



Learning PHP - Arithmetic Operators

Learning PHP - Constants

 

Monday, November 12, 2012

Learning PHP - Arithmetic Operators

Arithmetic Operators Sample Programs and Results


Addition +


                               Sum:



Subtraction -


                                       Difference:





Multiplication *



                                   Product:



Division /



                                     Quotient:





Modulus %


                                     Remainder:









Sunday, November 11, 2012

How To Recover Or Show Files From USB




Learning PHP - Constants

Constants

- an identifier for a simple value
- associated value cannot change by the program during its execution
- case sensitive, always uppercase by convention
- must begin with a letter or underscore
- define a constant by using define( ) function or const keyword
   ( when const is used, constants cannot be declared inside functions, loops or if statements )









Learning PHP - String Concatenation

Learning PHP - Variables

 

Saturday, November 10, 2012

Learning PHP - String Concatenation

String Concatenation

- process of joining two strings together.

String - Sequence of characters.
Concatenate - to link together, unite in a series of chain.

In PHP, the concatenation operator is ('.').


note: There is a space at the end of each string before the close quotation mark ( "Thanks space" ). I did this so that the output is not "ThanksForVisiting".

*The print command prints the strings or the value of the variables to the screen. You can also use echo.


Output in my browser:







Learning PHP - Variables

Learning PHP - Comments



Thursday, November 8, 2012

Learning PHP - Variables

Variables in PHP

- storage for values or expressions
- starts with $     ( ex: $sample1)
- variable name must begin with a letter or underscore  ( $student  or   $_student )
- no spaces   ( error: $stu dent,  should be: $student )   
- case sensitive ( $student is not the same with $Student )
- assignment operator is =  ( $student=1 ; assigns value number 1 to the variable )
- use quotes " " to assign text value  ( $student="Bram" )
- the value may change during program execution


Wednesday, November 7, 2012

Learning PHP - Comments

Comments
- To avoid confusions, getting lost in long lines of scripts or codes, comments are very useful.
- They make programs easier to understand.

Comments syntax in PHP:

// to make a one-line comment
/*    */ to make a block comment

In PHP, comments are colored green.


Notepad++ v 6.2 For Writing PHP Scripts

Notepad++ is great for writing PHP scripts.
 - Free source code editor written in C++
 - Supports several programming languages
 - Higher execution speed and smaller program size

Downloading and Installing Notepad++:



 

 


































































Hello world script:





How To Connect Notepad++ To XAMPP




Monday, November 5, 2012

How To Connect Notepad++ To XAMPP

I spent many hours searching for ways on how to connect Notepad++ to XAMPP. Like the way it is connected to a Web Server on the internet. But there seems to be no specific steps to what I'm looking for.
After gathering the clues ( consider forums as giving clues when the answer is not close ), trials and errors and analyzing, plus experience in IT, finally got it!

Here it is:

  • Run XAMMP Control Panel
  • Start FileZilla
  • Click Admin ( FileZilla )
  • Connect to Server ( click OK )
  • Click the User Account icon (one face) or go to Edit Menu then Users
  • Click Add ( assign a name )
  • Shared folders is: C:\xampp\htdocs ( Shared folders Page )
  • Check the box beside Files - Write option ( another bonus! I got 550 error code with this one )
  • Click OK
  • Open Notepad++
  • Go to Plugins menu, NppFtp, check Show NppFtp Window
  • Go to NppFtp Window, click Settings icon, then Profile settings
  • Create a Profile name, Hostname is: 127.0.0.1 
  • Username is the same with what you assigned in FileZilla
  • Initial remote directory is C:\xampp\htdocs
  • Close the Profile settings, click the Connect icon, then the Profile name

If successful, you will see: Nppftp - Connected to (profile name)
and the xampp folder below.


Images:





























Learning PHP - Installing XAMPP
Learning PHP ( Research, Self-study )




Popular Posts