Warning: Array to string conversion
An array was used where a string is expected — echoing it, concatenating it, or passing it to a string function.
Seen on:
PHP
Meaning
PHP prints the literal word “Array”. Often a form field submitted as an array (name="tags[]"), a function returning an array, or debug output with echo instead of print_r.
Common causes
echo $arrayor"text $array"- Form field with
[]in its name - Function returned an array where you expected a string
- Passing an array to htmlspecialchars/strlen
⚡ Quick fix
- Use
implode(', ', $array)to join - Use
print_r/var_dump/json_encodefor debugging - Check form field names
Detailed fix by platform
PHP
echo htmlspecialchars(implode(', ', (array) $_POST['tags']));
How to diagnose
- Value — var_dump() it — what does the array contain?
- Intent — Join, pick one element, or encode?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026