PHP
- 04 December
Get Parameters From URL String in PHP
Use parse_url() with parse_str() functions Use parse_url() with parse_str() to get parameters from URL String in PHP. The parse_url() function is used to return the components of a URL by parsing it and parse_str() is used to create an associate array of query parameters and their values. [crayon-6744b7076733e798217415/] [crayon-6744b70767346880743275/] Once you have the array of […]
- 02 December
Pass Variable From PHP to JavaScript
Use echo method In order to pass variable from PHP to JavaScript, you will need to use the echo statement. This will print out the variable for you. For example, if you have a variable named $name, you would use the following code: [crayon-6744b7076763b218688743/] This will output a piece of JavaScript code that looks like […]
- 02 December
Remove Quotes from String in PHP
1. Remove Quotes from String in Php 1.1 Using str_replace() Method Use the str_replace() function to remove quotes from String in PHP. [crayon-6744b707677bf257521312/] [crayon-6744b707677c3390052868/] We used str_replace() to remove double quotes and single quotes from the String. str_replace() replaces all instances of search string with replacement String. It takes three arguments: the string to search […]
- 26 November
Add Character to String in PHP
Strings are a sequence of characters considered immutable (unchanging once created). But how do we add characters to strings in PHP? This post will explain how to add characters to a string in PHP. PHP provides different built-in methods and approaches to add a character to a string. Importantly, the string will not be changed […]
- 25 October
How to check if String contains substring in PHP
Introduction A string is a sequence of characters used as a literal constant or variable. The specific part of a string is known as a substring. In this article, we will see different ways to check if string contains substring in PHP. How to check if a string contains substring in PHP? 1) strpos() function: […]
- 19 October
How to print an array in PHP
Introduction An array is one kind of data structure, which can store multiple items of related data types. The printing of an array is one of the fundamental functions of PHP. How to print an array in PHP? You can print an array with the values in different ways using the var_dump() or print_r() or […]
- 18 October
Declare empty array in php
An array is a data structure where you can store the same or different types of data in a single variable. In PHP, you can declare empty array using square brackets ([]) or using array() function. Using square brackets to declare empty array in PHP The below syntax can declare empty array in PhP. We […]