0

I have data of questions in mysql DB, lots of which contains single and double quotes. For example:

Which of the following statements create a dictionary?
1. d = {}
2. d = {“john”:40, “peter”:45}
3. d = {40:”john”, 45:”peter”}
4. All of the mentioned
Correct: D

On retrieving data using select statement in php file, this is what I am getting.This is output of print_r

MCQ [questionText] => Which of the following statements create a dictionary? [1] => Which of the following statements create a dictionary? [mcqanswer1] => d = {} [2] => d = {} [mcqanswer2] => d = {�john�:40, �peter�:45} [3] => d = {�john�:40, �peter�:45} [mcqanswer3] => d = {40:�john�, 45:�peter�} [4] => d = {40:�john�, 45:�peter�} [mcqanswer4] => All of the mentioned [5] => All of the mentioned [correctAnswer] => D

Basically it is converting all single and double quotes. Can someone suggest me what do I need to do. Thanks.

  • 1
    `“`this is not double quote . it's called smart quote. check this thread:- https://stackoverflow.com/questions/1262038/how-to-replace-microsoft-encoded-quotes-in-php – Alive to die - Anant Feb 14 '20 at 05:49
  • *Correct: D* There is no `D` answer mark/number in provided variants :) – Akina Feb 14 '20 at 05:55
  • @Akina check the second answer of thread. running code: https://3v4l.org/RQiE1 – Alive to die - Anant Feb 14 '20 at 05:58
  • I have used this solution : https://stackoverflow.com/questions/45276964/how-can-i-replace-all-special-characters-in-a-multidimensional-array . Now the issue I am getting is all double and single quotes are getting removed from the data. For example - [mcqanswer2] => d = {john:40, peter:45} [3] => d = {john:40, peter:45} [mcqanswer3] => d = {40:john, 45:peter} – Rakesh Singh Feb 14 '20 at 06:20

0 Answers0