marain
04-29-2012, 09:43 PM
My PHP source code contains a variable called $subhead[$here ]. I want to echo that variable if and only if two conditions are satisfied. The first condition is that $subhead[$here] is not empty. The second condition is that $subhead[$here] does not contain the word "Click". My PHP source code tests for those conditions. In the instance giving me problems, $subhead[$here] DOES contain the word "Click". Therefore, it should not be echoing its contents. But it echos anyway.
I have pasted the relevant source code (containing white space for readability), followed by the generated code. The code also echos html comments (imperfectly formatted), showing the values in the various variables.
I'm quite sure my error is elementary but I cannot find it. Please help.
A.
THE PHP SOURCE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New Jersey Criminal Defense Lawyer
<?php
/* test section */
$click = 'Click';
$bigBoole = strpos( $subhead[$here], $click, 0);
if ( $subhead[$here] && $bigBoole != 0 && $bigBoole != '0');
echo ' - ' . $subhead[$here];
echo '<!-- $subhead[$here] = ' . $subhead[$here] . '. -->\n';
echo '<!-- $click = ' . $click . '. -->\n';
echo '<!-- $bigBoole = ' . $bigBoole . '. -->\n';
/* end test section */
?>
</title>
********************************************************
THE GENERATED CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New Jersey Criminal Defense Lawyer
- Click <a href="http://www.MarainLaw.com/quest" style="color : #ff4040;">Here</a> for Your Confidential No-Obligation Case Evaluation<!-- $subhead[$here] = Click <a href="http://www.MarainLaw.com/quest" style="color : #ff4040;">Here</a> for Your Confidential No-Obligation Case Evaluation. -->\n<!-- $click = Click. -->\n<!-- $bigBoole = 0. -->\n
</title>
I have pasted the relevant source code (containing white space for readability), followed by the generated code. The code also echos html comments (imperfectly formatted), showing the values in the various variables.
I'm quite sure my error is elementary but I cannot find it. Please help.
A.
THE PHP SOURCE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New Jersey Criminal Defense Lawyer
<?php
/* test section */
$click = 'Click';
$bigBoole = strpos( $subhead[$here], $click, 0);
if ( $subhead[$here] && $bigBoole != 0 && $bigBoole != '0');
echo ' - ' . $subhead[$here];
echo '<!-- $subhead[$here] = ' . $subhead[$here] . '. -->\n';
echo '<!-- $click = ' . $click . '. -->\n';
echo '<!-- $bigBoole = ' . $bigBoole . '. -->\n';
/* end test section */
?>
</title>
********************************************************
THE GENERATED CODE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>New Jersey Criminal Defense Lawyer
- Click <a href="http://www.MarainLaw.com/quest" style="color : #ff4040;">Here</a> for Your Confidential No-Obligation Case Evaluation<!-- $subhead[$here] = Click <a href="http://www.MarainLaw.com/quest" style="color : #ff4040;">Here</a> for Your Confidential No-Obligation Case Evaluation. -->\n<!-- $click = Click. -->\n<!-- $bigBoole = 0. -->\n
</title>