<?php
class Produto {
public $nome;
public $preco;
public $descricao;
public function transformarJson(){
}
// Não consigo transformar meu objeto Produto em json usando json_encode
}
$produto = new Produto();
$produto->nome = 'Test';
$produto->preco = 'test';
$produto->descricao = 'e';
PD9waHAKY2xhc3MgUHJvZHV0byB7CgogICAgcHVibGljICRub21lOwogICAgcHVibGljICRwcmVjbzsKICAgIHB1YmxpYyAkZGVzY3JpY2FvOwoKICAgIHB1YmxpYyBmdW5jdGlvbiB0cmFuc2Zvcm1hckpzb24oKXsKCQkKCQlyZXR1cm4ganNvbl9lbmNvZGUoJHRoaXMpOwoJCQogICAgfQogICAgLy8gTsOjbyBjb25zaWdvIHRyYW5zZm9ybWFyIG1ldSBvYmpldG8gUHJvZHV0byBlbSBqc29uIHVzYW5kbyBqc29uX2VuY29kZQoKfQoKJHByb2R1dG8gPSBuZXcgUHJvZHV0bygpOwoKJHByb2R1dG8tPm5vbWUgPSAnVGVzdCc7CiRwcm9kdXRvLT5wcmVjbyA9ICd0ZXN0JzsKJHByb2R1dG8tPmRlc2NyaWNhbyA9ICdlJzsKCnZhcl9kdW1wKCRwcm9kdXRvLT50cmFuc2Zvcm1hckpzb24oKSk7