Passing arguments to PHP functions
lessonDuration 2m 28s
You can't get data into a function without arguments. In this lesson, we'll learn how to pass variables as arguments to PHP functions.
Browse
Find courses, lessons, articles, talks, and podcasts.
7,176 resources
Showing 1,057–1,080 · Page 45 of 299
lessonDuration 2m 28s
You can't get data into a function without arguments. In this lesson, we'll learn how to pass variables as arguments to PHP functions.
lessonDuration 2m 25s
Learn how to create variables in PHP, and the different naming conventions to use when naming variables.
lessonDuration 3m 24s
You'll eventually need to run a block of PHP code that executes if your "if" statement is false. In this event, you will use an "else"| clause.
lessonDuration 4m 26s
PHP "juggles" data types with something called "type coercion". Let's learn all about that!
lessonDuration 4m 13s
Using "require" for classes isn't a modern practice for PHP development. A much better option is to use Composer's autoloader to automatically import classes into your app.
lessonDuration 4m 19s
Once you start creating PHP classes, you'll want to organize them into groups of classes. In this lesson, you'll learn how to do just that with namespaces.
lessonDuration 3m 18s
Creating functions around your app is just fine, but when your app grows in complexity, you will want to create those functions as being part of PHP classes. This will help your app scale & expand with time.
lessonDuration 4m 1s
Class properties and methods can have different visibility levels, which control how private or protected those properties are.
lessonDuration 1m 43s
Creating class properties is useless unless you can read back that property! There's an easy way to do this, with PHP's shorthand arrow syntax.
lessonDuration 2m 47s
Attaching properties to a PHP class is important, so you can track specific values of data entities or functionality.
lessonDuration 2m 23s
It's very common to execute a piece of code when an object is created. In this lesson, you'll learn how to do just this with a PHP class constructor.
lessonDuration 2m 13s
Creating a class in PHP is quite easy with the "new" keyword, and can represent a specific data entity or functionality.
lessonDuration 4m 18s
Files can get hard to read & debug if they get too long. In this lesson, we'll learn how to include external files in your PHP scripts.
lessonDuration 2m 19s
Types are important in any programming language. In PHP, you can define argument & return types to build more reliable applications.
lessonDuration 3m 33s
A PHP function can encapsulate a block of code, but it can also return values. In this lesson, we will learn how to return values created within a function.
lessonDuration 1m 53s
Scope in PHP is how variables are encapsulated in pieces of code. Let's learn about function & global scope in PHP.
lessonDuration 1m 52s
In this lesson, we will go over how to create a function with proper syntax in PHP with the function keyword.
lessonDuration 1m 34s
Sometimes you need to group together pieces of code. That's what functions are for! In this lesson, we'll learn all about them.
lessonDuration 2m 34s
Storing an array within an array is possible with PHP, and are called "multi-dimensional" arrays.
lessonDuration 1m 26s
One can expand on PHP's foreach loop by using array indexes, which allow you to control the location of PHP elements.
lessonDuration 1m 56s
Iterating, or looping over an array is very easy with PHP's foreach loop.
lessonDuration 1m 11s
Lists are found in every programming language, and PHP is no exception. Let's learn how to create a list using an array.
lessonDuration 3m 7s
A switch statement includes a few awkward caveats that don't exist in PHP 8's new match statement. In this lesson, we will learn how to use a match statement to execute when a condition matches a specific value.
lessonDuration 4m 12s
When you find yourself repeating or writing similar conditional logic in your if statements, a better option may be a switch statement.