Fabian Tschullik Fabian Tschullik - 3 years ago 83
JSON Question

PHP append json with $ to http request body

$body->append('{"stage_id": "43"}');

I would like to make the "43" dynamic and use a $variable for the value: How should look the Syntax look like?

Answer Source

You can use just like this:

    $var = 43;
    $array = array('stage_id'=>$var);
    $json = json_encode($array);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download