i
PHP Variables
PHP Data Types
PHP Echo & Print
PHP Strings
PHP Numbers
PHP Constants
PHP Operators
PHP if...else...elseif Statements
Switch Statement
PHP Loops
PHP Arrays
Superglobals
PHP Coding Standards
PHP Form Handling
PHP Form Validation
PHP URLs Validation
PHP Form Required Validation
Complete Form Example
PHP File Functions Open/Read
PHP File Create/Write
PHP File Upload
PHP Cookies Handling
PHP Session Handling
PHP filter_var() Function
PHP Validation Filters
PHP Sanitization Filters
Using Filters
Filters Advanced
JSON
PHP Date and Time
MySQL Database
MySQL Connect
MySQL Commands-Creating a Table
MySQL Commands-Inserting The data
MySQL Commands-Prepared Statement
MySQL Commands-Selecting The Data
MySQL Commands-Where and Order By
MySQL Commands-Deleting And Updating The Data
PHP-OOP Introduction
PHP-Classes/Objects
PHP-Constructor/Destructor
PHP-Access Modifiers
PHP-Inheritance
PHP-Inheritance and Protected Access Modifier
PHP-Overriding Inherited Methods
PHP-Final keyword
PHP-Abstract Classes
PHP-Constants
PHP-Traits
PHP-Static Methods and Properties
Introduction to Functions
Defining A function
Returning Values From A Function
Dynamic Function Calls
Variable Scope
Understanding Arguments Or Parameters
Testing For A Function Existence
Returning Multiple Values From A Function
Making practical Use By Building Code Libraries For Code Re-usability
Using Include() And Require()
One of the most common types of data you will be working in any programming language is plain text and strings represents text in php. Any data in text or a sequence of characters that you want to present in the web page can be used inside the string, and you can just write the string in double quotation marks, and you can also store the string in a variable that allows you to manage the string easily.
For e.g.
$Favquote = "Don't be pushed around by the fears in your mind";
echo $Favquote;
You can use string functions to find out the information in strings or modify the values in the string. These are just snippets or codes when called they give some information or update the string. You can directly write the text inside these string functions or use variables inside the functions.
strtolower() – This function will return all the values in the lower case. For e.g. echo strtolower($Favquote); will return don't be pushed around by the fears in your mind.
strtoupper() - This function will return all the values in the upper case. For e.g. echo strtoupper($Favquote); will return DON'T BE PUSHED AROUND BY THE FEARS IN YOUR MIND.
strlen() – This string function will return the length of the values inside the function. For e.g. echo strlen($Favquote); will return 48.
str_word_count() – This string function returns the count of words inside the function or the variable. For e.g. echo str_word_count($Favquote) will return 10.
strpos() – If you want to search for a particular text within the string, you can use strpos function to return the position of the word. For e.g. echo strpos("$Favquote","fears"); will return 30.
strrev() – This string function will reverse the values of the string inside the function. For e.g. echo strrev($Favquote); will return dnim ruoy ni sraef eht yb dnuora dehsup eb t' noD.
str_replace() – It helps to replace certain values inside the string. For e.g., str_replace("fear", "panic", $Favquote) will return Don't be pushed around by the panic in your mind.
substr() – It allows us to grab and present some section of the string. For e.g. echo substr($Favquote, 30) will print fears in your mind.
Don't miss out!