How to Remove the Last Character of a String in PHP
If you need to remove the last character of a string in PHP, then you can do the following:
Option 1 – Using rtrim()
Syntax: rtrim($string, …
52 articles about php development, tools, and best practices
If you need to remove the last character of a string in PHP, then you can do the following:
rtrim()
Syntax: rtrim($string, …
If you need to create a PHP function that returns multiple values, then you can do one of the following.
array
function …
Read Article →
If you have a single-dimensional array, and want to break it into chunks, you can use the array_chunks
method.
It takes 3 arguments:
If you have some HTML input submitted from a user to your application, before saving it to the database, you may want to strip all <script>
tags …
Below is a quick and easy way to recursively delete all files and folders in a given path using PHP.
function destroy_dir($dir) {
if (!is_dir($dir) …
Read Article →
If you have a busy PHP driven website and don’t want to make constant queries to the database for each user that will see the same data, then …
Read Article →Let’s take a really common example. Say we want to follow redirects with cURL for google.com
. It is common to curl follow redirect a URL.
PHP is a powerful scripting language created for the web.
It has come a long way since it’s initial inception in 1994.
It was originally created to …
Read Article →<?php
//fromDate
2014 - 01 - 22
//toDate
2014 - 02 - 20
//$arr
Array(
[0] = & gt;
Array(
[ISO_DATE] = & gt;
2014 - …
Read Article →
Sometimes you will need to retrieve the GET variables passed into the current page URI or you will have a URL string to work from which contains …
Read Article →There are times when you want to remove a specific HTML tag from an HTML block of text.
This could be an anchor(<a/>
) or an image(<img/>
) …
I often need a quick and easy few lines to retrieve some data from MySQL using Joomla without all the MVC nonsense that usually goes about this topic. …
Read Article →