How to check form submission in PHP ?
Given a form and the task is to check form submitted successfully or not. Use the PHP program for the backend to check form submission and HTML and CSS to create the form as frontend....
read more
How to add days to $Date in PHP?
Adding days to $Date can be done in many ways. It is very easy to do by using built-in functions like strtotime(), date_add() in PHP.Method 1: Using strtotime() Function: The strtotime() Function is used to convert an English textual date-time description to a UNIX timestamp. Syntax:...
read more
PHP multidimensional array search by value
In PHP, multidimensional array search refers to searching a value in a multilevel nested array. There are various techniques to carry out this type of search, such as iterating over nested arrays, recursive approaches and inbuilt array search functions....
read more
Convert timestamp to readable date/time in PHP
Problem: Convert timestamp to readable date/time in PHP Solution: This can be achieved with the help of date() function, which is an inbuilt function in PHP can be used to format the timestamp given by time() function. This function returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given....
read more
How to make PDF file downloadable in HTML link using PHP ?
To Download PDF from HTML link using PHP with the help of header() function in php. The header()function is used to send a raw HTTP header. Sometimes it wants the user to be prompted to save the data such as generated PDF....
read more
Saving an Image from URL in PHP
Sometimes, need to download an image from a particular URL and use it into the project. It’s easy to go to the page and use right click button and save the image. But what if you wanted to do it programmatically? The reasons may vary person to person, developer to developer. If set of hundreds of image URLs given and somehow want to save them into the machine, or need to use this concept into the projects. Then definitely not going to download each one of those files manually....
read more
Function overloading and Overriding in PHP
Function overloading and overriding is the OOPs feature in PHP. In function overloading, more than one function can have same method signature but different number of arguments. But in case of function overriding, more than one functions will have same method signature and number of arguments. Function Overloading: Function overloading contains same function name and that function performs different task according to number of arguments. For example, find the area of certain shapes where radius are given then it should return area of circle if height and width are given then it should give area of rectangle and others. Like other OOP languages function overloading can not be done by native approach. In PHP function overloading is done with the help of magic function __call(). This function takes function name and arguments. Example:...
read more
How to pass variables and data from PHP to JavaScript ?
In this article, let’s see how to pass data and variables from PHP to JavaScript....
read more
getAttribute() – Passing data from Server to JSP
Suppose some data at the Server side has been created and now in order to pass that information in a JSP page, there is a need of request.getAttribute() method. This, in fact differentiates the getAttribute() and getParameter() methods. The latter is used to pass Client side data to a JSP....
read more
Program to find absolute value of a given number
Given an integer N, The task is to find the absolute value of the given integer....
read more
How to return multiple values from function in PHP?
PHP doesn’t support to return multiple values in a function. Inside a function when the first return statement is executed, it will direct control back to the calling function and second return statement will never get executed. However, there are ways to work around this limitation. The multiple values can be returned from a function by using an array.Example 1: This example shows how to return multiple values from a function in PHP. First, create an empty array end push the element to the array and then return the array....
read more
How to avoid undefined offset error in PHP ?
The Offset that does not exist in an array then it is called as an undefined offset. Undefined offset error is similar to ArrayOutOfBoundException in Java. If we access an index that does not exist or an empty offset, it will lead to an undefined offset error.Example: Following PHP code explains how we can access array elements. If the accessed index is not present then it gives an undefined offset error....
read more