Karl Karl - 1 year ago 66
PHP Question

CakePHP variable parsing change

I have a strange problem; I have a variable, as follows:

$postBSGlobal = $post['Post']['B/S']

Which, when debugged, correctly delivers


But, later on the value magically changes to


Without me manipulating the variable in any way.

I need the string-value for this statement:

if ($userId <> $post['Post']['OWNER'] && $postBSGlobal = 'B'){
echo "Dein Verdienst:";

Today my app is completely unusable due to this problem. Maybe the PHP-version on my managed server has changed? How can I prevent PHP from returning the "1"?

Answer Source

You used a single = instead of ==. Change it to:

$postBSGlobal == 'B'

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download