1

I have an array that is from unserialized array in php, I have posted this question(how to break one column with huge text data into multiple column or array in sql and php to understand how unserialize array works from sql data. This was my data

a:3:{i:o;"Is maths easy".<
 br /> <div class="user-answers"><br /> <p class="strongly-disagree" 
>Strongly Disagree</p> <"Is physics easy".<
 br /> <div class="user-answers"><br /> <p class="strongly-disagree" 
>Strongly Disagree</p> <

Now I am having issue in getting specific information. If I have

 [0]
              [0] => Is maths easy
              [1]=> user-answers

    [1] 
              [0]=>Is physics easy
              [1]=> user-answers

Now I want to get let say 50 users answered these questions. Some user might left answer empty. I want to make a percentage like

user who answered/Total users

Any clue how can I get this information out of the array I got from unserialzed array.

aimee
  • 61
  • 8
  • Why don't you store the individual entries in your database? Databases are good in working with large sets of data (filtering, combining, calculating). Now you have to do it all in php – Ivo P Sep 05 '17 at 09:41
  • @ Ivo P they are already stored as serialized array in database. its already pre build. I just need to use this info. – aimee Sep 05 '17 at 11:19
  • at a second look: it is even worse. This is not serialized data: it is a serialized dump (in html) of some array. So you have a textual presentation of how the dump of the array (using print_r) would look like. And that polluted with html tags. You could take a look at https://stackoverflow.com/questions/16226057/recreate-original-php-array-from-print-r-output but it is the hard way – Ivo P Sep 05 '17 at 14:13

0 Answers0