Category: Basic

  • Operators Types

    What are Operators in PHP? As in any programming language, PHP also has operators which are symbols (sometimes keywords) that are predefined to perform certain commonly required operations on one or more operands. hey are used to do calculations, compare values and make decisions in code. They are important for writing good programs. For example, using…

  • Return Type Declarations

    PHP version 7 extends the scalar type declaration feature to the return value of a function also. As per this new provision, the return type declaration specifies the type of value that a function should return. We can declare the following types for return types − To implement the return type declaration, a function is…

  • Scalar Type Declarations

    The feature of providing type hints has been in PHP since version 5. Type hinting refers to the practice of providing the data type of a parameter in the function definition. Before PHP 7, it was possible to use only the array, callable, and class for type hints in a function. PHP 7 onward, you can also…

  • Date & Time

    The built-in library of PHP has a wide range of functions that helps in programmatically handling and manipulating date and time information. Date and Time objects in PHP can be created by passing in a string presentation of date/time information, or from the current system’s time. PHP provides the DateTime class that defines a number…

  • Compound Types

    Data types in PHP can be of “scalar type” or “compound type”. Integer, float, Boolean and string types are scalar types, whereas array and object types are classified as compound types. Values of more than one types can be stored together in a single variable of a compound type. In PHP, objects and arrays are…

  • Heredoc & Nowdoc

    Heredoc and Nowdoc are PHP methods that allow you to write long strings without using too many quotes or escape characters. They allow you to write multi-line strings in a neat and readable manner. PHP provides two alternatives for declaring single or double quoted strings in the form of heredoc and newdoc syntax. Heredoc is useful for including variables,…

  • Maths Functions

    Mathematical operations are important parts of programming. PHP has several built-in math functions that make calculations easy. These functions can be used to round numbers, find maximum and minimum values, work with exponents and logarithms and so on. In this chapter, we will look at different PHP math functions and mathematical (arithmetic) operators and how…

  • Files & I/O

    PHP Files and I/O is the process of reading, writing, creating and deleting files. PHP has various functions for easy file management. We can open a file and write to or read from it. Functions like fopen(), fread() and fwrite() are very useful. Files allow you to store data for later use. Getting data from…

  • Integers

    Integers in PHP Integer is one of the built-in scalar types in PHP. A whole number, without a decimal point in the literal, is of the type “int” in PHP. An integer can be represented in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation. To use octal notation, a…

  • Boolean

    Boolean Type in PHP In PHP, “bool” is a basic data type. It informs if something is true or not. A Boolean can only have two values: true or false. True and false in PHP can be written in several ways, such as true, TRUE, or True, and they all mean the same thing. Boolean…