LMSouq
php-dev Open

Are arrays in PHP copied as value or as reference to new variables, and when passed to functions?

FR
Frank
1 month ago
3 views
Problem Description
1) When an array is passed as an argument to a method or function, is it passed by reference, or by value? 2) When assigning an array to a variable, is the new variable a reference to the original array, or is it new copy? What about doing this: $a = array(1,2,3); $b = $a; Is `$b` a reference to `$a`?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base