Php返回值错,任何想法为什么?

Before posting i'd like to say, i'm quite new to PHP.

It returns "value wrong", which is an echo i created:

$fields = array(  "amount"=>("5"),
                  "selected_customfields"=>("26656"),
                  "pageno"=>("0"),
                  "show_active_only"=>("1"),
                  "api_group"=>("//i removed this for here"),
                  "api_secret"=>("//i removed this for here"));

// Make the POST request using Curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);   
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

// Decode and display the output
$api_output =  curl_exec($ch);
$json_output = json_decode($api_output);
$output = $json_output?$json_output:$api_output;

// Clean up
curl_close($ch);

echo '<pre>';
var_dump($output);
echo '</pre>';


$output_filtered = array();

    foreach ($output as &$value) {
        echo '<pre>';
        $type = $value->cf_value_26656;

    if($type == "Opzet & webdevelopment (Eenmalig)") {
        var_dump($value);   
    } else {
        echo 'value wrong';
    }
    //var_dump();

        echo '</pre>';
        echo '==================================';
    }

The cf_value_26656 is right, as i'm quite new to this. Someone might quickly see the mistake..

I hereby updated it to more code I have, excuse me for not uploading it before.

Greetings,

Kevin

Since your var_dump outputs

string(37) "Opzet & webdevelopment (Eenmalig)"

We can see there are 4 missing characters (33 characters in that string). Since you are debugging in a browser the output isn't the real output. The & is really &amp; which renders as &. The amp; accounts for the 4 missing characters. So either modify your check for the entity, or decode the entity to its character.

if($type == "Opzet &amp; webdevelopment (Eenmalig)") {

or

if(html_entity_decode($type) == "Opzet & webdevelopment (Eenmalig)") {