Skip to content

PHP date add 5 year to current date

I have this PHP code: $end=date(‘Y-m-d’); I use it to get the current date, and I need the date 5 years in the future, something like: $end=date(‘(Y + 5)-m-d’); How can I do this?

How to check if the request is an AJAX request with PHP

I would like to check server-side if a request to my php page is an ajax request or not. I saw two ways to do this: First way: sending a GET parameter in the request which tells the page that this is an AJAX request (=mypage.php?ajax) mypage.php: Second way: set a header to the xmlHttpRequest: client-side js:…

file_get_contents seems to add extra returns to the data

Hi I am trying to run a simple php file open, replace, and save. Here is my code: My file opens, does the replace, and saves the file. But when I opened the file I noticed that there was an extra line return after every item that previously had only one line return. I tested printing out the data directly

shell_exec() returning null on “ls”

So I have this code and I’m only trying to make a list of the saves in another directory where the php scrip is in xampp folder and the saves are to this path /root/files/saves: <body&…

Jquery removing commas

I’m using the following and it works, but the alerted value opt3 contains commas. How do I remove them? If I select a c & d the alert shows a,c,d but I want it to show acd. Answer What about this? Update: Ok. Like @jreziga mentioned. The return value of .val() will be an array. If you have a string