How-to articles, tricks, and solutions about PHP
Confirm button before running deleting routine from website
Yes, you can add a confirm button before running a delete routine on a website using PHP.
Connect to SQL Server through PDO using SQL Server Driver
Here is an example of how to connect to a SQL Server database using PDO and the SQL Server driver:
Convert column integer values into date expressions
To convert column integer values into date expressions in PHP, you can use the date function.
Convert date to day name e.g. Mon, Tue, Wed
In PHP, you can use the date function to convert a date to a day name.
Convert flat array to a delimited string to be saved in the database
You can use the implode() function to convert an array to a delimited string in PHP.
Convert plain text URLs into HTML hyperlinks in PHP
You can use the preg_replace() function in PHP to convert plain text URLs into HTML hyperlinks.
Converting <br /> into a new line for use in a text area
In PHP, you can use the nl2br() function to convert line breaks (\n or \r\n) to <br /> tags.
correct PHP headers for pdf file download
To download a PDF file in PHP, you will need to use the appropriate HTTP headers.
create folder in laravel
In Laravel, you can create a new folder using the File facade's makeDirectory method.
Creating anonymous objects in php
In PHP, anonymous objects can be created using the new class syntax.
Creating new Date Time from string
In PHP, you can use the DateTime class to create a new date and time object from a string.
Curl and PHP - how can I pass a json through curl by PUT,POST,GET
To pass a JSON object through cURL using the PUT method, you can use the following command:
curl error 18 - transfer closed with outstanding read data remaining
Error 18 means that the transfer was closed with outstanding read data remaining.