Basics of PHP – Module 2

Data Types available in PHP

PHP data types are used to hold different types of data or values. PHP supports 8 primitive data types that can be categorized further in 3 types:

  1. Scalar Types (predefined): It holds only single value. There are 4 scalar data types in PHP.
    1. boolean
    2. integer
    3. float
    4. string
  2. Compound Types (user-defined): It can hold multiple values. There are 2 compound data types in PHP.
  3. array
  4. object

Special Types: There are 2 special data types in PHP.

  1. resource
  2. NULL

Note: Resources are not the exact data type in PHP. Basically, these are used to store some function calls or references to external PHP resources. For example - a database call. It is an external resource.

Null is a special data type that has only one value: NULL.

Variables in PHP

Variables are the identifier of the memory location, which used to save data temporarily for later use in the program. The purpose of variables is to store data in memory for later use.

We can make any variable types, like numbers, text strings, and arrays. All variables in PHP start with a $ dollar sign, and the value can be assigned by using the = assignment operator.

PHP Variables are case sensitive, variables always defined with a $, and they must start with an underscore or a letter (no number).

In PHP, unlike other languages, variables do not have to be declared before assigning a value.

You also don't require to declare data types, because PHP automatically converts variable to data types depends upon its value.

Constants in PHP

Constants are like a variable, except that their value never changes during execution once defined.

The constant value is immutable.

Constant within a script is accessible to any area; however, they can be scalar values.

Constant names are case-sensitive, and they also follow the same naming requirements like variables, except the leading $.

It is considered best practice to define constants using only upper-case names.

PHP define() function defines a constant.

Types of Operators in PHP

PHP offers various types of operators having different functioning capabilities.

  1. Arithmetic Operators
  2. Assignment Operators
  3. Comparison Operators
  4. Logical Operators
  5. Concatenation Operators

Comments in PHP

Single Line Comments

// (Single line comment)

Multi Line Comments

/* (Multi line comment) */

Introduction
The branch of mathematics in which we studied numbers is arithmetic.    
In Arithmetic, numerals 1, 2, 3, 4 , -------- etc. and four fundamental operations : addition , subtraction, multiplication and division are used to deal with various problems. In Algebra, in addition to numerals, we use letters such as x, y, z in various situations to solve the problems.

Matchstick Patterns
Ram and Sarita are making patterns with matchsticks. They decide to make simple patterns of the letters of the English alphabet. Ram takes two matchsticks and forms the letter L as shown in Fig (1). Then Sarita also picks two sticks, forms another letter L and puts it next to the one made by Ram Fig (2). Then Ram adds one more L and this goes on as shown by the dots in Fig (3).

Number of matchsticks required = 2 × number of Ls. For convenience, let us write the letter n for the number of Ls. Thus, n can be any natural number 1, 2,  3, 4, 5, .... We then write, Number of matchsticks required = 2 × n. Instead of writing 2 × n, we write 2n. Note that 2n is same as 2 × n.

Continue reading to

Join any of the batches using this book

Batch List

Online classes has started.
SP Bright Coaching Classes

Course : CBSE Class 6

Start Date : 10.08.2022

End Date : 31.12.2022

Types of Batch : Live Online Class

Subject M T W T F S S
Mathematics(2 hours) 5:00 PM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Science(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
English(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Hindi(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Social Science(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
history(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
English Literature(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
English Language(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Hindi Literature(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Hindi Language(2 hours) 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM 8:45 AM
Olympiad ,NTSE,IIT FOUNDATION  CLASS.
Competitive Pundit

Course : CBSE Class 6

Start Date : 10.08.2022

End Date : 31.12.2022

Types of Batch : Live Online Class

Subject M T W T F S S
Mathematics(- hours) 4:30 PM 4:30 PM 4:30 PM 4:30 PM 4:30 PM 4:30 PM 4:30 PM
6th class math
Baal Vani Global Education

Course : CBSE Class 6

Start Date : 10.08.2022

End Date : 31.12.2022

Types of Batch : Live Online Class

Subject M T W T F S S
Mathematics(- hours) 6:30 PM 6:30 PM 6:30 PM 6:30 PM 6:30 PM 6:30 PM 6:30 PM

Chapter 11

Algebra

Patterns and Variables

Introduction – Algebra
Algebra is the branch of Maths that uses alphabetical letters to find unknown numbers. These letters are also called variables. The values, which are known in the given expression similar as numbers, are called constants.
 

Algebra involves the simple operation of mathematics like addition, subtraction, addition, and division involving both constant as well as variables. For case, x +10 = 0.

Patterns
Number patterns
Still, again, its successor is (n +1); if a natural, number is denoted by n.
Case Successor of n = 10 is n +1 = 11.
Still, also 2n is an indeed number and (2n +1) is an odd number, If a natural number is denoted by n.
Illustration
If n = 10, further 2n = 20 is an even number and 2n +1 = 21 is an odd number.

Patterns using matchsticks/Ice candy sticks,
Matchstick Patterns
 No. of matchsticks used to make 1st square = 4
 No. of matchsticks used to make 2nd square = 7
 No. of matchsticks used to make 3rd square = 10
 Therefore, the pattern that we observe now is 3n +1
With this pattern, we can freely find the number of matchsticks needed in any number of squares.

 Illustration
How numerous matchsticks will be used in the 50th figure?

 Answer
 3n+ 1
 3 × 50 1
 = 151 matchsticks

More about variables,
Variable

A variable is an unknown volume that is prone to change with the environment of a situation.
Example In the expression 2x+5, x is the variable.
Examples on variables
Examples of Variables are:
3 + x = 2
X = 3
(a+b) ² = a² + b² + 2ab

Continue reading to

Join any of the batches using this book

Batch List

class 6th  mathamatics
Medha Sharma

Course : CBSE Class 6

Start Date : 10.08.2022

End Date : 01.04.2023

Types of Batch : Classroom

Subject M T W T F S S
Mathematics(7 hours) 4:45 PM 4:45 PM 4:45 PM 4:45 PM 4:45 PM 4:45 PM 4:45 PM