Browsing:

Tag: webtechsource

How do I Convert Date Format in PHP

Hello friends, We uses PHP strtotime() and date() functions to convert date format in php. For example we have stored a date YYYY-MM-DD format in a variable and need to change this to MM-DD-YYYY format. We can achieve this by converting date first to seconds using strtotime() function. After that reconstruct date to any format using date() function. Examples are below 1. Change YYYY-MM-DD => MM-DD-YYYY Here we have date Read more…


Check if Value Exists in PHP Array

Hello friends, Now i am explain how we check value exist in array. in_array() is the function in php to Check if a value exists in an array using PHP. Learn about Php

    Parameters: The in_array() function accepts three parameters, out of which two are compulsory and other one is optional. All three parameters are described below: val: This is a required parameter which specifies the element Read more…


Wrapping Text with PHP wordwrap() Function

Occasionally your PHP script will need to break up a long line of text into several shorter lines while preserving whole words. This can happen if you’re formatting some text for printing or emailing, or you want to display preformatted text in a Web page using the pre element. PHP gives us a function, wordwrap(), to do this job for you. The wordwrap() function wraps a string into new lines Read more…


HTML5 Force Download

HTML5 Force Download, Mostly we want to download any image file and pdf from server  Or When you link to a file like an image , PDF-document it will be displayed within the browser normally. The download-attribute in links prevents this behaviour and offers the file as a download in your browser. HTML5 Force Download In html5 we can easily set up force download with an attribute called download, just Read more…


Difference Between Include And Require In PHP

Functional Work : Both functions perform similar work. Both functions will include and evaluates the specific file while executing the code. Functional Difference : if include() is not able to find a specified file on location at that time it will throw a warning however, it will not stop script execution. For the same scenerio require() will throw fatal error and it will stop the script execution. PHP include and Read more…


Difference Between implode and explode In PHP

In coding many times we need to convert a string into array and array into string for that we used explode and implode in php. The explode function in PHP allows us to break a string into smaller text with each break occurring at the same symbol. This symbol is known as the delimiter. … The explode() function breaks a string into an array, but the implode function returns a Read more…


Sessions in php

A PHP session is easily started by making a call to the session_start() function.This function first checks if a session is already started and if none is started then it starts one. It is recommended to put the call to session_start() at the beginning of the page. Session variables are stored in associative array called $_SESSION[]. These variables can be accessed during lifetime of a session. Make use of isset() Read more…