The Period "." operator used to concatenate two or more strings together.
Ex:
<?php
$text1 = "Programming Languages";
$text2 = "for Beginners";
echo $text1 . " " . $text2; // Two string variables and a space join together
?>
This blog supports beginners to get deep knowledge about programming in HTML, CSS, JavaScript, php, asp and other Web technologies and VB, VB.net, Java,step by step from the beginning. All the programming Concepts discuss with simple examples for the readability. Try out daily uploaded lessons to be a Programmer.
PHP - Heredoc String Creation
PHP traditional string creation method I've mentioned in earlier post. That method common to most of the programming languages. PHP introduces a more robust string string creation tool called Heredoc, it creates multi-line strings without using single or double quotes. This methods seems to be easy but it's too difficult and can be lead to arise errors if you do not properly code the string.
PHP - Conditional Statements
Conditional Statements are used to perform different actions based on the conditions.
In PHP, there are few conditional statements are used to do that.
In PHP, there are few conditional statements are used to do that.
- If Statement
Perform some actions if the condition is true. - If.. Else Statement
Perform some actions if the condition is true and another actions if its false. - If... ElseIf Statement
Perform some actions according to the conditions provided - Switch Statement
Blocks of codes can be executed
PHP - Constants
PHP Constant is an identifier for a value like a variable but it has some unique characteristics such as,
How to set a PHP Constant
There is a key word calling "define" uses to define the constants in PHP.
- Once you create a constant then you cant change it
- Once you create a constant then you cant undefined it
- Value cannot be changed during the script
- Constant Name starts with a Letter or underscore sign. There is no $ sign for constants.
How to set a PHP Constant
There is a key word calling "define" uses to define the constants in PHP.
PHP - How to read content of a file
PHP can read the content of files such as txt, doc, etc and can be displays it onto the web page as a HTML document.
Syntax:
readfile(<filename>);
Syntax:
readfile(<filename>);
JavaScript - Data Types
It is not necessary to define the data type when initializing the variables in Javascript. It automatically gets the data type of the variable according to the value stored in the variable. That is calling Dynamic Type Variables. Therefore Same variable can be used to store following kind of data in JavaScript
1. String
A set of characters can be stored by putting between the Double Quotes or Single Quote
Syntax:
var <variable name> = '<Value>' OR
var <variable name> = "<Value>"
Ex:
var student = "John"; // OR
var student = 'John';
var Relationship= "John's car"; // Can put single Quotes within Double Quotes
var car = 'John has "Toyota" car'; // Can put Double Quotes within Single Quotes
2. Number
Numbers in the can be written with or without decimal places.
var no1 = 50;
var no1 = 53.25;
1. String
A set of characters can be stored by putting between the Double Quotes or Single Quote
Syntax:
var <variable name> = '<Value>' OR
var <variable name> = "<Value>"
Ex:
var student = "John"; // OR
var student = 'John';
var Relationship= "John's car"; // Can put single Quotes within Double Quotes
var car = 'John has "Toyota" car'; // Can put Double Quotes within Single Quotes
2. Number
Numbers in the can be written with or without decimal places.
var no1 = 50;
var no1 = 53.25;
Javascript - Comments
We are using comments to make Javascript more readable and comments are not executed by JavaScript. That can be used to explain the coding. In JavaScript, there are two types of comments can be used,
01. Single Line Comments
Single Line Comments begins with 02 forward slashes and there is no ending, its
applicable to the whole line which it puts.
Syntax:
// <Comment>
Ex:
// This is a single line Comment
var no = 0; // This is Number type variable
02. Multi Line Comments
Multi Line Comments begins with a /* and ends with */.
Syntax:
/* <Comment> */
Ex:
/* This is a Multi line Comment
Purpose of this comment is explain
the code with more than one line */
Subscribe to:
Posts (Atom)