1

I am trying to write string to screen without quotes in php. I get the string data from a Mysql database and I try to write it to a textbox but double quotes are also written.

Example : "a2" .

i want that just write => a2 .

$gönder= (json_encode($gönder) );
    echo $gönder;

string data is $gönder .

piet.t
  • 11,718
  • 21
  • 43
  • 52

3 Answers3

4

Use it like this :

echo trim($gönder, '"');
Fahad Nisar
  • 1,723
  • 12
  • 18
0

Since $gönder is a string, json_encode($gönder) will wrap it in double quotes.

Just echo it before applying json_encode:

$gönder = 'a2';
echo $gönder; // a2
$gönder = json_encode($gönder);
echo $gönder; // "a2"
roberto06
  • 3,844
  • 1
  • 18
  • 29
0

use this code

echo trim($gönder, '"');

deep
  • 350
  • 1
  • 7