Configuring XAMPP PHP in Windows 10 Environment Variables If you’re using XAMPP on your Windows 10 machine, and would like to add the php command so that it’s usable in command prompt, you’re in the right place. Start by typing in Environment Variables in your Search and click on the Edit the system environment variables result. In the System Properties window click Environment Variables. Make sure that you’re on the Advanced tab. Scroll down to the Path variable and click Edit. Click on the Browse button. Navigate to C:/xampp/php and click OK. You will now see the path to php inside the window. Click OK to exit. Restart your Command Prompt window if it’s open and type in: php -v You
Tag: PHP
Mastering Email Testing and Sending in PHP Testing and sending emails are very important aspects of email deliverability. There are various standards and authentication such as SMTP and MIME, Base64 and DKIM that must be followed if you are using PHP based online-services to test and send emails. There has been a rise in the number of alternative methods that we may use to test and send emails with PHP throughout the years, which will be discussed in this post. Let’s get started! Table of Contents Testing Emails in PHP Email Testing Checklist Various methods for testing emails in PHP Sending
Where Laravel developers feel right at home It can sometimes feel like the documentation skips a few steps here and there. Other times, the documentation can feel overwhelming. Let’s demystify this process. Goals to accomplish: Introduction to Homestead Setup Homestead on Windows 10 for all of your websites Create a Laravel 8 application SSH into Homestead and create a database Migrate database tables Verify that everything is working: able to type in domain.test in our browsers. Introduction to Homestead The first step, of course is to go to the Laravel documentation. We’ll follow it throughout this article so that if something changes
Code’s way of solving problems within itself Recursion is the last topic on PHP that we’ll cover before I make the switch to Laravel. Recursion is not a PHP topic, but I’ve been asked about it so frequently that I thought we would do an article on it. It has been a fun ride and thanks for reading along on this PHP series. What is Recursion? You can get into the deep understanding of it, but for the sake of simplicity, it’s a function that calls itself from inside of the function body. In reality, it’s a way to solve
Bridging the gap between data and code I don’t know about you, but I absolutely love JSON. JSON, or JavaScript Object Notation, is a way to store and transport data. Whether we’re generating JSON objects to be sent from the server or accepting JSON objects from the client, we need to understand the JSON format. Don’t think too much into it: JSON is just a string. JSON can start with either a bracket ( [ ) or a curly brace ( { ). Either works. The object is represented with a curly brace and an ordered list starts with a
Scope surprises in PHP: The joy of debugging Scope is the variable and function visibility that a certain portion of the program has. For example, let’s say that we declare a variable inside of a function. Other functions will not have access to that variable. <?php function hello() { $name = “Dino”; echo “Hello ” . $name; // has access } function bye() { echo “Bye ” . $name; // Doesn’t have access } That variable ($name) has local scope to the function where it was created. Variables can have global scope and be accessed anywhere (not always immediately). Those
PHP’s magic methods: Invoke, toString, get, set – Class wizardry in a nutshell. We’re on the last of the built in functions/methods that PHP has to offer. We’re nowhere close to the full extent of the built in functions that PHP offers, but I think we’ve covered the most frequently used ones. In this article, we’ll look at __invoke, __toString, __get and __set methods. PHP has a few “magic methods” like __construct, __destruct, __call, __callStatic, __get, __set, __isset, __unset, __sleep, __wakeup, __serialize, __toString, __invoke, __setState, __clone, and __debuginfo. We’ve already covered the __call, __construct and __destruct magic methods. https://blog.devgenius.io/php-p101-trim-htmlspecialchars-and-call-built-in-functions-7b4f25728db9 trim(), ltrim(), rtrim() htmlspecialchars() __call()
Navigating arrays is an art, and PHP’s functions are your paintbrushes Getting close to completion. In the last article we looked at string functions and in this one we’re going to take a look at all the various and common array functions. https://www.dinocajic.com/string-functions/ trim(), ltrim() , rtrim() htmlspecialchars() __call() preg_match() filter_var() addslashes() str_replace() strlen() strtolower() strtoupper() ucfirst() strpos() , stripos() , strrpos() , strripos() Array Functions like: array_chunk(), array_diff(), array_key_exists(), array_key_first(), array_key_last(), array_map(), array_merge(), array_push(), array_sum(), asort(), arsort(), count(), in_array(), ksort(), krsort(), sort(), rsort(), shuffle(), sizeof(), is_array(), explode(), implode() Magic Methods like: __invoke(), __toString() array_chunk() If you have an array,
Strings bend to your will with PHP’s dynamic functions This article is all about string functions. These are simple built-in functions that require little to grasp. They’re conveniently named to simplify what the operations will accomplish. After we finish string functions, we’ll move on to array functions, which are just as simple. trim(), ltrim() , rtrim() htmlspecialchars() __call() preg_match() filter_var() addslashes() str_replace() strlen() strtolower() strtoupper() ucfirst() strpos(), stripos(), strrpos(), strripos() Array Functions like: array_chunk(), array_diff(), array_key_exists(), array_key_first(), array_key_last(), array_map(), array_merge(), array_push(), array_sum(), asort(), arsort(), count(), in_array(), ksort(), krsort(), sort(), rsort(), shuffle(), sizeof(), is_array(), explode(), implode() Magic Methods like: __invoke(), __toString() Addslashes() Starting off
Efficient Filtering and validation We just finished looking at preg_match and regular expressions in general. One thing that you might have quickly realized was that it’s how we used to validate whether an email was valid or not. There’s an easier way to do that now and it’s with the filter_var function. We won’t go into all of the details, but let’s explore the filter_var built-in function. trim(), ltrim() , rtrim() htmlspecialchars() __call() preg_match() filter_var() addslashes() str_replace() strlen() strtolower() strtoupper() ucfirst() strpos(), stripos(), strrpos(), strripos() Array Functions like: array_chunk(), array_diff(), array_key_exists(), array_key_first(), array_key_last(), array_map(), array_merge(), array_push(), array_sum(), asort(), arsort(), count(), in_array(), ksort(), krsort(), sort(), rsort(), shuffle(), sizeof(),