KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a PHP array of numbers, which I would like to prefix with a minus (-). I think through the use of explode and implode it would be possible but my knowledge of php is not possible to actually do it. Any help would be appreciated. Essentially I would like to go from this: $array = [1, 2, 3, 4, 5]; to this: $array = [-1, -2, -3, -4, -5]; Any ideas?
Tags (comma-separated)
Save Edits
Cancel