Use this file at the top of every PHP page (before any output): 🧩 What This Does ✅ Stores session files in /sessions/ …
$state_list = array( 'Alabama', 'Alaska', 'Arizona', 'Arkansas', …
<?php ######## Sending email with attachment ######## function sendMail( string $fileAttachment, string $ma…
PHP code is provided for three situations. In these situations, you should need to delete all files functionality in yo…
The special characters from string can be easily removed using preg_replace() function in PHP. The preg_replace() funct…
<?php if(isset($_POST['button']) && isset($_FILES['attachment'])) { $from_email …
Solution 1: Create a distinctive index for the (user, label, empid) . As a result, the database will prohibit the cre…
I am using base64 for encryption and decryption. encrypt.php <?php $id= $_GET['id']; $encrypted = encrypt($i…
Array with range of numbers at random order: $numbers = range(1, 20); shuffle($numbers); Wrapped function: function Uni…
function generate_id($uri) { /* regular expressions */ $regex1 = '/[^a-zA-Z0-9]/'; //remove anything bu…
<?php // Function to get all the dates in given range function getDatesFromRange($start, $end, $format = 'Y-m-…
<?php /** * @category iCalendar * @description Basic code for sending an event invitation. * @version 1.0 *…
Here considering the date and picture are same for each userid. // define an empty array $new_array = array(); // loop…
What I am trying to output in html: <p>January, 1<sup>st</sup>, 2011</p> What I am doing now (f…
I am building a simple friend/buddy system, and when someone tries to search for new friends, I want to show partially …
function getConsecutiveWorkDays($date){ list($year,$month,$day) = explode('-',$date); $holidays = array…
Method - 1 function ordinal($numm) { $num = trim($numm); if (!in_array(($num % 100), array(11,12,13))){ swi…
function countDays($year, $month, $ignore) { $count = 0; $counter = mktime(0, 0, 0, $month, 1, $year); whil…
What is REST? REST stands for Representational State Transfer, REST is an architectural style which defines a set of …
PHP