Deep Tech Point
first stop in your tech adventure
Home / PHP
March 1, 2022 | PHP

In this article, we are going to learn about the for loop in PHP – we are going to look at the for loop syntax through a simple example. In the end, we will learn what can we do if we want to introduce two conditions in a for loop and find a minimal value.

February 7, 2022 | PHP

If you are a complete scraping beginner, this article is for you. If not, move on, because we are going to learn about scraping and parsing, but without using regular expressions or any supporting libraries. Moreover, we will do it using basic PHP string functions. Sure, PHP is not the best language choice for scrapping and parsing but it’s easy to learn and comprehend so it is a good candidate for beginners. First, we are going to explain what parsing is. Then, we are going to have a look at arrays, the GET method, stream_context_create and file_get_contents functions. Afterward, we are going to apply the strpos and substr functions, and at the end of this mini-project, we are going to display the results using print_r function.
Roll your sleeves PHP beginner, we are diving in.

May 17, 2021 | PHP

Developers often need to escape special characters when they’re coding and PHP is not an exception neither. In PHP we’re familiar with an abundance of escaping functions and some of them deal with encoding HTML entities. In addition, MySQL is also particular when it comes to special characters and it has its own set of rules: they are usually covered with escaping functions such as addslashes. However, when we talk about storing JSON in MySQL the approach in escaping special characters is a bit different.

February 10, 2021 | PHP

The beauty of PHP is that you can do one thing in several different ways. And, yes, this is the case with PHP arrays too – they can be merged using the + array union operator or you could use the array_merge() function. However, there is a difference between array_merge and array + array, so let’s take a look at the functions we’re are dealing with.

February 4, 2021 | PHP

This article is going to focus on the comparison operator known as Equal Operator and presented as “==” or double equal sign, and the inbuilt strcmp() function. We are going to look at the differences and similarities between these two.

January 28, 2021 | PHP

You might get into a situation where you need to hook some PHP function. There are many reasons why you might need to do that. One of the most obvious cases is debugging. In PHP it is really easy to hook any function using override_function which overrides built-in functions. However, these simple “hacks” are practical only in conditions when you’re dealing with your own code or some relatively simple code you can change with ease.

In a more complex situation, like if you need to hook the PHP mail function without messing with some third-party source code you need to do it a bit differently.

January 18, 2021 | PHP

You could come into a situation where you are dealing with HTML special characters in some text. Ordinary users might not even notice these special characters exist because when they take a peek at a text in a browser these characters look exactly like normal characters do. However, if you – an advanced user – take a look into the page source, you’ll notice some very unusual presentations, (&amp; for &, &quot; for “, &lt; for <, &gt for > and so on). So, the question is – how do you convert this mumbo jumbo to normal characters?

January 9, 2021 | PHP

As you probably know it’s possible to install multiple versions of PHP on one server. For web servers, simply define which PHP version you want to use in your server’s configuration file. But how to do it for PHP cli?

January 2, 2021 | PHP

PHP can sometimes be confusing when it shouldn’t be. One area of confusion is the issue with “duplicate” built-in functions. I’m always inclined to think that language makers probably had a good reason to make duplicates and most of the time that is a good assumption.
But is it always true? Let’s see an example of echo end print functions. Technically speaking neither echo nor print are functions but language constructs so you don’t need to use parentheses with its arguments.

<?php
echo "get ready: ", 1, 2, 3, " go";  // outputs get ready: 123 go
print "get ready: 123 go";  // print can't handle multiple arguments like echo
?>