Posts marked with "Error" in tags

Variables in Bash ": command not found"

Bash is like the very complicated language, even a space can make a syntax error. But, when you get into it often, you will get a hang of it and it will be easy.

This post is a solution to one of the most common problems that happen to a newbie in Bash and it’s about a single whitespace.

Here is a sample Bash file :

a = 50
echo $a

and when you execute it, the error will be as follows :

... [READ MORE]

Check If A String Is JSON in PHP

In my previous post, I gave the isHTML function that returns if a string is HTML or not. In this post, I will give you a simple function of different ways that helps in the detection of valid JSON string in PHP. The function I’m giving are fast, easy and doesn’t take up too much CPU memory.

Method 1

JSON (JavaScript Object Notation) can be made in to a PHP object using json_decode. If the return is not an object, the string we gave is not JSON. This is the principal of Method 1 function.

... [READ MORE]

Create Your Own URL Shortening Service Using PHP & jQuery

I made a URL shortening service a year back using PHP & jQuery. It was pretty simple. You should know the concept of URL Shortening. The concept is simple. When a user sends a request to short a URL, PHP will check if the URL is valid. If it’s valid then PHP will make a string of 5 or 6 characters. A folder is created with the name of this string and an index.php file with header function code is created in this folder. This will make the folder redirect to the URL the user requested. Since it’s a folder no extensions will be seen ! So You can make up some pretty good URL‘s.

... [READ MORE]

How to display errors in a PHP file ?

When you code PHP some errors might have happened. But you won’t know that and the program don’t work. You can use PHP‘s error_reporting function to display errors. Here’s how to do it:

Create a file named errors.php in the folder where the file with errors exist.
Open the errors.php file in text editor and paste these codes in the file:

error_reporting(E_ALL);
ini_set("display_errors", 1);
include("filename.php");
?>

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab