![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
Let's say I have an array:
$array = "50,60,70,80,90"; And I want to take each element of the array and do something with it. The specific something is a mathmatical operation; let's say I want to subtract 10 from each number. Then, after subracting 10 from each number, I want so put all the results back into a new array. The new array would look like "40,50,60,70,80". How do I write this? I know to start with something like: $exploded_array = explode(",",$array) But where do I go from there? (And in the explode(), does $array need to be enclosed in quotes or not?) No members have liked this post.
|
|
#2
|
||||||||
|
||||||||
You can also use foreach, like this:
But I think the first method is more elegant. ![]()
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
||||||||
|
#3
|
||||
|
||||
|
Chen I forget but why do you add a & to the front of a variable in certain cases?
No members have liked this post.
|
|
#4
|
||||
|
||||
|
Thanks!
No members have liked this post.
|
|
#5
|
||||
|
||||
http://php.fastmirror.com/manual/en/...references.php
__________________
Chen Avinadav Formerly vBulletin.org Owner and Founder chen@avinadav.com No members have liked this post.
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
| Thread Tools | |
|
|
| New To Site? | Need Help? |
All times are GMT. The time now is 21:03.



