MFA Posted May 20, 2013 Share Posted May 20, 2013 I am wondering how to replace several values in an array with a single variable. I have tried just simply creating a variable for all the values within the array (e.g. $variable = $round1.",".$round2.",".$round3) and substituiting that in however it doesn't work as the array understands the comma's literally and outputs them on the page. The original line of code is below. Thank you. $myData->addPoints(array($round1,$round2,$round3),"Frequency"); Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 20, 2013 Share Posted May 20, 2013 Your question is not clear, but I think you either want to list() or serialize() your data. I think I remeber hearing somewhere that serialize and arrays don't get on the best, but I could well be getting mixed up. My question to you is - do you need to use an array in the first place? Quote Link to comment Share on other sites More sharing options...
MFA Posted May 20, 2013 Author Share Posted May 20, 2013 (edited) Yes I know, it's difficult to explain. Unfortunately, I have to use an array, this is template code from pChart and I have to fill in the array values as they represent the values of the bar graphs.I am still not sure how to go about this using the list() function. Edited May 20, 2013 by MFA Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 20, 2013 Share Posted May 20, 2013 ok, looking at the api docs for pchart, you are supposed to be entering an array there just the way you are doing it. Can you show us what you are actually trying to do, with perhaps some sample data? Quote Link to comment Share on other sites More sharing options...
Barand Posted May 20, 2013 Share Posted May 20, 2013 Do you mean $var = array($round1, $round2, $round3); $myData->addPoints($var,"Frequency"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.