To print an array in PHP, you can use the built-in print_r() function, which prints or displays information about a variable, including its type and value.
PHP print_r() Syntax
print_r(variable, return).
Where:
variable: specifies the array about which we want to get information
return (Optional): when set to "True", this function will return information, but not print it. The default value is "False".