Web Programing for Beginners

Is this blog helpful for you? Can you recommend for someone?

I much appreciate your kind suggestions and comment to improve the contents & writing method of this blog. Because you are the actual reader of this site and strive to sharpen your web programming knowledge.

You may knowing further more about the discussed topics or have articles, links related to the topics please put it in your comment. Those comments more helpful others as well as me.

--
Best regards,
Priyal

PHP - Print the Processed data


It is the way to see the processed php data by sending it to the browser as an out put. You can display the contents within the browser to see the users. There are several ways allows in php to send out put to the browser. I'm discussed here most important & common methods here.
  • echo() statement
    This is the most common out put generation method in php. echo() statement accept multiple arguments.
    syntax:
    echo (string arg1[, string arg2, ...]);

PHP - Arrays

There are two types of array namely,
  • Single Dimensional Array
  • Multi Dimensional Array 
Arrays can store multiple information in a single variable. If you are using variables to store 4 values then you need to the followings.
  $bookName = "Sample Book";
  $bookAuthor = "Author\'s Name";
  $bookPublished = "April 02, 2013"; 
  $bookPublisher = "Sample Book Publisher";
But you can store above all values to a single array. 
  • Single Dimensional Arrays
    Ex:
    $book = array(
         "Sample Book",
         "Author's Name",
         "April 02, 2013",
         "Sample Book Publisher"
         ) //use a book array to store above values
    echo "Book Name : " . $book[0]; // Print 1st element of the array

PHP - Numbers

There are two types of Numbers can be declared with php.
  • Whole Numbers
    Integer data type uses to store positive or negative whole Numbers (without decimal points). It is not required to define integers because php is a loosely typed language. You are define a whole number without double quotes then it automatically evaluate as an integer value. But you can force the value store as integer by using casting. 
    Ex:
    1, -50
    $num = 50 // Numbers are define without double or single quotes
    $num = (int) 50 // This is a casting example. Here force to store the value as integer.
    $num = (int) "5years" // Taken the value as 5

    $num = (int) "age10" // Taken the value as 0
     

  • Real Numbers
    Double and Float data type uses to store positive or negative whole Numbers (with decimal points). 
    Ex:
    15.3325, -5.586240
    $num = 50.5589// Real Numbers are define without double or single quotes
    $num = (double) 50.569 // This is a casting example. Here force to store the value as real number.
    $num = (double) "5.85Km" // Taken the value as 5
    .85
    $num = (double) "age10.6" // Taken the value as 0

    $num = (float) "10.53yards" // Taken the value as10.53

PHP - String

String Variables are used to store set of characters enclosed with single (') or double (") quotes. In this post covering general operations and operations of string.
Ex:
  <?php
      $str = "PHP programing with String"; // Assign characters to string variable
      echo $str; // Print the string
  ?>

Out put: 
PHP programing with String


  • String Concatenation
    You can put two or more strings together with (.) operator.
    Ex: 
      <?php
        $str1 = "PHP Programing";
        $str2 = " with String";
        echo $str1 . $str2;
      ?>

    Out put: 
    PHP programing with String