Hi rowanparker,
No, that would output 2353.
ok I shortened my code down to this:
$cPath_new_a = $categories['categories_id']. ",";
$cPath_new_b = rtrim($cPath_new_a , ',');
$cPath_new_c = $cPath_new_b;
echo $cPath_new_c;
However, same issue that outputs 2353. What am I missing here?
Let me try to explain things:
$categories['categories_id'] pulls a sub category ID out of the database based on what main category the user is in. The example I have been using is a main category with 2 subcategories 23 and 53. $categories['categories_id'] alone echos 2353. I want to make this into an array that contains 23 and 53.
I thought the best way to accomplish this would be to add a , to make the string 23,53, then remove the last , then use explode(); to convert the comma delimited string into an array. However rtrim/substr both are not working for me. Is there some way to convert $cPath_new_a into an actual string within the code (not a dynamic variable) then apply rtrim or substr? Or am I approaching this whole thing incorrectly?