Reputation:
Okay let me simplify..
I have a list of ids in a variable $paramsId = 10,38,8,4,36,
..
I now need to separate these numbers into separate variables so i used list($slide1, $slide2, $slide3, $slide4, $slide5) = explode(",", $params->get('id'));
then i placed it in a array:
$a = array(
"one" => $slide1,
"two" => $slide2,
"three" => $slide3,
"four" => $slide4,
"five" => $slide5
);
and then it gets put into a foreach statement:
foreach ($a as $k => $val) {
$args = $val;
$item[] = ModArticleSlider::getArticles($args);
}
all i am trying to achieve is that foreach number in $paramsId separate the values with a "," and then place each seperated value into variables named "$slider1, $slider2(and so forth)" then place those variables in an array.
Any Help Greatly Appreciated.
Upvotes: 0
Views: 80
Reputation: 2817
just use
$a = explode(",", $params->get('id'));
then try a print_r($a) and check if your values are in the array.
Upvotes: 1