Browsing:

Category: Php Knowledge

Building a Bootstrap Contact Form Using PHP and AJAX

Hello friends, In this tutorial I’ll go over the steps to create a working contact form using Bootstrap, in combination with AJAX and PHP. From there we can explore some additional features such as some fancy CSS animation with animate.css, further validation in jquery. you need to add some css and js files in your folder.   Html Form Start Here : <!DOCTYPE html> <html> <head> <title>Contact form </title> <meta Read more…


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…


Remove Last Character from String in PHP

Hello friends, Here We describes 3 methods to remove last character from a string in PHP programming language. You can use any one methods according to your requirement requirement. Method 1 – substr_replace function Use the substr_replace function to remove the last character from a string in PHP. Syntax: substr_replace($string ,””, -1); Example: $string = “Hello Webtechsource Admin!”; echo “String: ” . $string . “\n”; echo “Output string: ” . 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…


Prevent Browser Caching of CSS and JavaScript Files

Can we solve this? Is there some way to prevent CSS caching? This post is about Preventing Css and Js Files being Cached on client Machine, we often change our css & js files to enhance our websites, if you send that same link to your client, and the same thing happens to them. There is a good chance there will be (at the very least) some confusion. due to Read more…


PHP replace only first occurrence of a string match

How to replace only the first occurrence of a string in php. Say you wanted to only replace the first occurrence of a string match instead of all occurrences You would use php preg_replace function to do the trick. Example is below: <? $data = ‘abcdef abcdef abcdef’; // pattern, replacement, string, limit echo preg_replace(‘/abcd/’, ‘webtechsource’, $data, 1); // outputs ‘webtechsourcedef abcdef abcdef’ ?> Just incase if you wanted to Read more…