PHP tutorial for beginners: How to print strings in PHP scripting language

Helping you to understand the basic of PHP scripting language. This may be your first step to the mysterious world PHP.

PHP is a script language commonly used by webmasters to design dynamic websites. Unlike HTML which has static content, PHP has dynamic content because of user interaction. Today, most of the qualified websites are designed by PHP or CGI.

PHP scripts embedded into the HTML codes. When someone checks the source code of the page, he doesn’t get anything about PHP scripts. He only learns the HTML part of coding. This article is an introduction to PHP scripting language. One can find useful information and have enough knowledge after reading my PHP tutorial series. Without delay, I would like to start my script creation step by step.

Before starting, you should know that you have to set up PHP installations into your computer. Such installations are PHP itself, Phpmyadmin interface, Mysql database and Apache Server. Without these, your scripts are nothing since they are not compiled by your computer.

Step 1:

To write PHP scripts, we need a place. That place is a simple text editor. You are free to choose your text editor. I prefer to use Notepad. There are other alternatives like Editplus or Elfima. If your operating system is not Windows but Linux, you can place your code into Vi editor or Pico. I have never tried but I think you can use Dreamveawer, Hotdog or Frontpage.

In your text editor, open an new file and save it as “myfirst.php” or “myfirst.html” . I choose the name of file as “myfirst” but you are free to choose anything.

Step 2:

I have told you before that PHP scripts are embedded into HTML codes. So, first of all we will write HTML codes. The basic codes are HTML, TITLE, HEAD and BODY. It can be written by lowercase letters as well. This part is not important.

Step 3: All PHP scripts start with “ ”. Only the part between two is compiled by server and evaluated as output.To print characters on the screen, standart output functions of PHP are used. Those are “ print ” and “ echo ”. In some circumstances, ” printf ” is used too.

The format of printing:

  1. print ( “ your output ” ) ;
  2. print “ your output ” ;
  3. echo “ your output ” ;
  4. echo ( “ your outpu t” ) ;

If you don’t use any white space characters, the strings are written without any separation. For example if you write this code;

  • Print ( “ Word1 ” ) ;
  • Print ( “ Word2 ” ) ;

It will be outputted as Word1Word2.

To remove this fault,white space characters are used. In PHP code part, between print functions, we place < br > code.

Example: To be more understandable,I will write a simple PHP script. Output will be the name of my favorite Triond writers.

To see the output, Click here.

Natural Illusion : Sexy Blonde Girls in Black Stockings

Jared Stenzel

I’m actually trying to learn php. I’ve been reading a book for the last month or so trying to learn it.


Php works with Apache console and sql databases and also Phpmyadmin interface. It has many great features in programming.


Another interesting thing about PHP is that because it is dynamic, it can be loaded into DRAM (D is for dynamic). HTML being static can run only on servers supporting SRAM (S is for static). PHP stands for “Private Home Page”, and it is used to make your home page private (for security) so that no one else can see it. It is possible to use PHP or CGI to create well qualified websites. But if you use CGI, then all of the code must be written in front of a green backdrop so that special effects can be added later on. The special effects themselves use pixels, and pixels are very hard to come by. Because pixels can be 32 bits or more or less. And when color is added to the 3 phosphors, things can get somewhat complicated, mostly because of the gamma and chroma.


“Php works with Apache console and sql databases and also Phpmyadmin interface. It has many great features in programming.”

More like PHP can be loaded as an Apache module or ISAPI. PHP has libraries to work with SQL databases, among many others. phpMyAdmin is written in PHP and interfaces with MySQL, it is not an interface to PHP.


“PHP stands for “Private Home Page”, and it is used to make your home page private (for security) so that no one else can see it.”

PHP actually used to stand for Personal Home Page tools. It is now Hypertext Pre-Processor, which is a recursive ancronym.

The bit about no one else being able to see it is only true is the server properly parses the PHP and doesn’t serve raw source code.

comments powered by Disqus