Key Concepts

Review core concepts you need to learn to master this subject

PHP built-in functions

echo "I am built in";

PHP comes standard with many built-in functions. They give us an easier way to implement and repeat popular tasks throughout a program. A popular example is the echo function.

Many more are documented at In addition to a description of what the function does, the documentation for each function denotes:

  • The name of the function
  • Required parameters and their types
  • Optional parameters (in square brackets, []), their types, and default values
  • The return type of the function (after the final colon, :)
Intro to Built-in PHP Functions
Lesson 1 of 1
  1. 1
    If you’ve been paying attention so far, you might have picked up a theme in programming—shortcuts. Defining our own functions gives us an easier way to repeat similar code throughout a program. B…
  2. 2
    PHP includes useful built-in functions for getting information about variables. The gettype() function takes a variable as its argument and ret…
  3. 3
    We can find PHP built-in functions to accomplish common tasks. Need to reverse a string? There’s a built-in function for that! The [strrev() function](…
  4. 4
    A substring is a portion of a string. For example, “hello” is a substring of the string “Oh hello, how are you?” and “el” is a substring of the string “hello”. Manipulating strings is very common…
  5. 5
    Another common task in programming is working with numbers, so it shouldn’t surprise us that PHP comes with some handy built-in functions for working with numbers. The [abs() function](https://ww…
  6. 6
    Generating random numbers may not seem obviously useful, but, as your programs become increasingly complicated, you’ll see this is actually a common task—for example to randomize data for testing. …
  7. 7
    In order to understand built-in functions we’ve never used before, we’ll want to get comfortable understanding how they are represented in the documentation. Documentation typically includes: + The…
  8. 8
    In order to find out about built-in functions (and other language features), you’ll want to get comfortable exploring the PHP documentation. The docs ca…
  9. 9
    In this lesson, you learned that built-in functions are functions provided by PHP. You learned about several specific built-in functions, how to understand a function’s description in the documenta…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo