PHP | Converting string to Date and DateTime
Converting the string to Date and DateTime uses several functions/methods like strtotime(), getDate(). We will see what these functions do. strtotime() – This is basically a function which returns the number of seconds passed since Jan 1, 1970, just like a linux machine timestamp. It returns the number of seconds passed according to the parameter passed to the function. Syntax...
read more
Download file from URL using PHP
In this article, we will see how to download & save the file from the URL in PHP, & will also understand the different ways to implement it through the examples. There are many approaches to download a file from a URL, some of them are discussed below:...
read more
How to Encrypt and Decrypt a PHP String ?
In PHP, Encryption and Decryption of a string is possible using one of the Cryptography Extensions called OpenSSL function for encrypt and decrypt. openssl_encrypt() Function: The openssl_encrypt() function is used to encrypt the data. Syntax:...
read more
How to get parameters from a URL string in PHP?
The parameters from a URL string can be retrieved in PHP using parse_url() and parse_str() functions....
read more
How to run JavaScript from PHP?
JavaScript is the client side scripting language and PHP is the server side scripting language. JavaScript is used as client side to check and verify client details and PHP is server side used to interact with database. In PHP, HTML is used as a string in the code. In order to render it to the browser, we produce JavaScript code as a string in the PHP code....
read more
How to pass JavaScript variables to PHP ?
JavaScript is the client side and PHP is the server-side script language. The way to pass a JavaScript variable to PHP is through a request....
read more
Best way to initialize empty array in PHP
Arrays in PHP: Use array() Function to create an array in PHP. There are three types of array supported in PHP:...
read more
Split a comma delimited string into an array in PHP
Given a long string separated with comma delimiter. The task is to split the given string with comma delimiter and store the result in an array....
read more
How to declare a global variable in PHP?
Global variables refer to any variable that is defined outside of the function. Global variables can be accessed from any part of the script i.e. inside and outside of the function. So, a global variable can be declared just like other variable but it must be declared outside of function definition....
read more
Concatenation of two strings in PHP
There are two string operators. The first is the concatenation operator (‘.‘), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (‘.=‘), which appends the argument on the right side to the argument on the left side....
read more
How to remove the first character of string in PHP?
Remove the very first character of a given string in PHP Examples:...
read more
How to read user or console input in PHP ?
In PHP, the console is a command-line interface, which is also called interactive shell. We can access it by typing the following command in a terminal:...
read more