/    Sign up×
Community /Pin to ProfileBookmark

Weird matching issue

[code=php]
if ($file != $product[$k][‘items’][‘data’][‘tag’] ||
$file != $product[$k][‘code’] ) {

echo “<div>Could not read <b>$loc”;
if($kdir) { $kdir = array_shift(explode(‘/’, $kdir));
echo “-$kdir”; }

echo “+$file.php</b> “;
echo “<br /><b>Session Logged</b></div>n”;
attempted();
inc(‘foot’);
}
[/code]

So

[code=php]
$file == 0107 (True) || $file == qbm (True)
$file == $product[$k][‘items’][‘data’][‘tag’] (True) || $file == $product[$k][‘code’] (True)

But if $file == 9999 and
$product[$k][‘items’][‘data’][‘tag’] == 0107
$file != $product[$k][‘items’][‘data’][‘tag’](False)
[/code]

WTF?! ?

to post a comment
PHP

18 Comments(s)

Copy linkTweet thisAlerts:
@ehimeauthorJun 03.2010 — More understandable
[code=php]
echo "<br />File: $file";
echo "<br />Code: {$product[$k]['code']}";
echo "<br />Tag: {$product[$k]['items']['data']['tag']}";
echo '<br />File is Code: '; echo ( $file != $product[$k]['code'] ) ? 'True' : 'False';
echo '<br />File is Tag: '; echo ( $file != $product[$k]['items']['data']['tag'] ) ? 'True' : 'False';

if ($file != $product[$k]['items']['data']['tag'] ||
$file != $product[$k]['code'] ) {

echo "<div>Could not read <b>$loc";
if($kdir) { $kdir = array_shift(explode('/', $kdir));
echo "-$kdir"; }

echo "+$file.php</b> ";
echo "<br /><b>Session Logged</b></div>n";
attempted();
inc('foot');
}
[/code]


echo out this, but it makes no sense
<i>
</i>// File is input, code and tag are called in to match
File: 0107
Code: 0107
Tag: qbm

// True or False
File is NOT Code: False
File is NOT Tag: True


My if should be passed over?
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 03.2010 — Looks like

[COLOR=#000000][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]$file [/COLOR][COLOR=#007700]!= [/COLOR][COLOR=#0000bb]$product[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]$k[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'items'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'data'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'tag'[/COLOR][COLOR=#007700]] ||



should be



[/COLOR]
[/COLOR]
[COLOR=#000000][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]$file [/COLOR][COLOR=#007700]!= [/COLOR][COLOR=#0000bb]$product[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]$k[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'items'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'data'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'tag'[/COLOR][COLOR=#007700]] [SIZE=5][B]&&[/B][/SIZE][/COLOR][/COLOR]
Copy linkTweet thisAlerts:
@ehimeauthorJun 03.2010 — No luck...
Copy linkTweet thisAlerts:
@ehimeauthorJun 03.2010 — If File, from the beginning
[code=php]
if ($file) {
$kdir = (isset($kdir)) ? $kdir : $product[$k]['sid'];
$k = ($product[$k]['data']['img'] == 0)
? URL . $handle.$file
: $noimg;
/*
$product = array_shift($product);
if ($file != $product['items']['data']['tag'] &&
$file != $product['code']) {

echo "<div>Could not read <b>$loc";
if($kdir) { $kdir = array_shift(explode('/', $kdir));
echo "-$kdir"; }

echo "+$file.php</b> ";
echo "<br /><b>Session Logged</b></div>n";
attempted();
inc('foot');
}
*/
foreach($product AS $products) {

if ($file == $product['items']['data']['tag']) {

$token = uniqid(); #Set Unqiue

$payload .= $ret.'<div class="tk">';
$payload .= '<form action="" id="ID_' . $token . '">';
$payload .= "<div style='font-size:11px;margin-top:5px;";
$payload .= "float:right;z-index:9999'>";

$payload .= "<b><x class='sColor'>&#8226;</x> Section: </b>";
$payload .= "<a class='tracker'"; // Illegal tagging

$payload .= "href='{$_SERVER['PHP_SELF']}?{$loc}'>";
$payload .= $products['s_title'] . '</a> / ';

$products['sid'] //Pop Trailing Slash
= array_shift(explode('/', $products['sid']));

$payload .= "<a class='tracker' href='";
$payload .= "{$_SERVER['PHP_SELF']}?{$loc}";
$payload .= "-{$products['sid']}'>";
$payload .= $products['cid'] . '</a> / ';
$payload .= "</div>";

$payload .= $ret.'<p>';
$payload .= '<b id="centername">';
$payload .= $products['items']['name'];
$payload .= '</b></p></form></div>';

$payload .= $ret.'<div><div class='content'>'.$ret;

$payload .= $ret.'<img id="prod" class='figure vMinus' ';
$payload .= 'alt="Product Large" src="'.$k.'-01.jpg" />'.$ret;

// JIC ;)
$vdo_response = $products['items']['data']['vdo'];

$vdo_response
= ($vdo_response != 'FALSE')
? $vdo_response
: NULL;

// Might want this later
if ($vdo_response == FALSE) {
$payload .= '';
}

if ($vdo_response) {

$vdo_object = NULL;
$vdo_object .= _browser( 'msie' ) ?
'<object id="ISIE" class="swfobject"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="291" height="220"
style="visibility: visible;">

<param name="movie"
value="'.URL.'swfobject/'
.$products['items']['data']['vdo']
.'_controller.swf?'

.$products['items']['data']['vdo']
.'.flv" />'

: //IEOR

'<object id="NOIE" class="swfobject"
type="application/x-shockwave-flash"
width="291" height="220"
data="' .URL.'swfobject/'
.$products['items']['data']['vdo']
.'_controller.swf?'

.$products['items']['data']['vdo']
.'.flv">';

$vdo_object .=
'<param name="quality" value="best" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<param name="allowfullscreen" value="true" />
<param name="scale" value="showall" />
<param name="allowscriptaccess" value="always" />
</object>';
}

$needle = array("t", "r", "n");
$payload = $payload .= str_replace($needle, "", $vdo_object);

if( $products['items']['required']['id'] == 'TRUE' ) {

inc('crypto', 'php');
array_shift($products['items']['required']);

$src = $header_image
= URL . '/images/products/' .
$loc . '/' . $products['section'];

$p = $products['items']['data']['img'];
if ( $p > 1 ) {
$payload .= $ret.'<div id="imagepacker">';
$i = 1; while ( $i <= $p ):
$t = str_pad( $i, 2, "0", STR_PAD_LEFT );

$payload .= "$ret<a href='$k-$t.jpg' rel='shadowbox[";
$payload .= "{$products['items']['data']['tag']}"];";
$payload .= "$options' title='Click to Expand: ";
$payload .= "{$products['items']['name']}'><img src='$k";
$payload .= "-$t-sm.jpg' alt='' /></a>"; $i++;

endwhile;
$payload .= "$ret</div>$ret"; }
}

if( $products['items']['required']['id'] == 'SPECIAL' ) {

inc('crypto', 'php');
array_shift($products['items']['required']);

foreach ( $products['items']['required'] as $key => $val ) {
$payload .= str_replace('"', '"', decrypt($val));
}

}

$payload .= "$ret</div><div style='margin:0 0 -65px;color:#fff;'>&nbsp;</div>";

if($product['cat']['items']['required']['id'] == 'TRUE') {

$spec = array (
0 => 'Specifications', 1 => 'Information',
2 => 'Maintenance', 3 => 'Safety',
4 => 'Troubleshooting', ); # Declare TAPS

$i = 0;

$payload .= "$ret<div class='menu'>";

$i = 0; $garbage = 'pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw=';
foreach ($products['items']['required'] AS $key => $val) {

if ($i == 0 && $val == $garbage) {
$top .= "$ret<div class='tab bnone'><p>";
$top .= "{$spec[$i]}</p></div>";

$bottom .= "$ret<div name='xs' id='xs$i' class='hide'></div>";
$i++;
}

if ($i != 5 && $val == $garbage) {
$top .= "$ret<div class='tab bnone'><p>";
$top .= "{$spec[$i]}</p></div>";

$bottom .= "$ret<div name='xs' id='xs$i' class='hide'></div>";
$i++;
}

if($i == 0 && $val != $garbage) {

$output = dec($val);

$top .= "$ret<div class='tab'><a href='javascript:tap("xs$i");'>";
$top .= "{$spec[$i]}</a></div>";
$bottom .= "$ret<div name='xs' id='xs$i' class=''>";
$bottom .= "$output</div>";

$last_output = $output;
$i++;
}

if ($i != 5 && $val != $garbage) {
$output = dec($val);
if($last_output != $output) {

$top .= "$ret<div class='tab'><a href='javascript:tap("xs$i");'>";
$top .= "{$spec[$i]}</a></div>";
$bottom .= "$ret<div name='xs' id='xs$i' class='hide'>";
$bottom .= "$output</div>"; $i++;
}
}

}

$payload .= $top.$rt2 .= $bottom;

$payload .= "$ret</div>$ret";
$i = NULL; # Destroy Increments

}

}
}
} // If File
[/code]
Copy linkTweet thisAlerts:
@ehimeauthorJun 03.2010 — var_dump $product
<i>
</i>
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "0107"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(6) "Q-Beam"
["pid"]=&gt;
string(22) "L-Q-BEAM4.95mW/L-Q200G"
["required"]=&gt;
array(6) {
["id"]=&gt;
string(4) "TRUE"
["spec"]=&gt;
string(5292) "M0zOgi0aHMSIrHNXJd7S1HsBWZM6uPtyXeASqLxXiC+="
["info"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["mnts"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["safe"]=&gt;
string(5292) "M0zOgi0aHMSIrHNXJd7S1HsBWZM6uPtyXeASqLxXiC+="
["trbl"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(1)
["tag"]=&gt;
string(3) "qbm"
["vdo"]=&gt;
string(7) "qbeam00"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(4) "TRUE"
["oval"]=&gt;
string(12) "2000.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(14) "Q1D34x17x12W29"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "0139"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(11) "Stinger RGB"
["pid"]=&gt;
string(13) "STINGERRGB-1W"
["required"]=&gt;
array(6) {
["id"]=&gt;
string(4) "TRUE"
["spec"]=&gt;
string(5292) "M0zOgi0aHMSIrHNXJd7S1HsBWZM6uPtyXeASqLxXiC+="
["info"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["mnts"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["safe"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["trbl"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(3)
["tag"]=&gt;
string(3) "sti"
["vdo"]=&gt;
string(12) "stingerrgb01"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(4) "TRUE"
["oval"]=&gt;
string(9) "0.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(5) "FALSE"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "9999"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(32) "Variance Application Information"
["pid"]=&gt;
string(8) "VARIANCE"
["required"]=&gt;
array(1) {
["id"]=&gt;
string(5) "FALSE"
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(1)
["tag"]=&gt;
string(3) "fda"
["vdo"]=&gt;
string(5) "FALSE"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(5) "FALSE"
["oval"]=&gt;
string(9) "0.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(5) "FALSE"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "0109"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(6) "Q-Scan"
["pid"]=&gt;
string(6) "Q-SCAN"
["required"]=&gt;
array(6) {
["id"]=&gt;
string(4) "TRUE"
["spec"]=&gt;
string(5292) "M0zOgi0aHMSIrHNXJd7S1HsBWZM6uPtyXeASqLxXiC+="
["info"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["mnts"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["safe"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
["trbl"]=&gt;
string(44) "pU8kkBef1nLa/RATsm3vZHGg51rPjiEU2JHBpWenxWw="
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(3)
["tag"]=&gt;
string(3) "qsc"
["vdo"]=&gt;
string(5) "FALSE"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(5) "FALSE"
["oval"]=&gt;
string(12) "2000.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(13) "Q1D12x12x12W7"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "9998"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(8) "Sky Scan"
["pid"]=&gt;
string(8) "SKY-SCAN"
["required"]=&gt;
array(1) {
["id"]=&gt;
string(5) "FALSE"
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(2)
["tag"]=&gt;
string(3) "ssc"
["vdo"]=&gt;
string(5) "FALSE"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(5) "FALSE"
["oval"]=&gt;
string(9) "0.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(5) "FALSE"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
array(1) {
["cat"]=&gt;
array(7) {
["s_title"]=&gt;
string(6) "Lasers"
["s_head"]=&gt;
string(4) "head"
["cid"]=&gt;
string(19) "Professional Lasers"
["sid"]=&gt;
string(3) "pr/"
["code"]=&gt;
string(4) "9997"
["items"]=&gt;
array(4) {
["name"]=&gt;
string(20) "Q-Scan Expansion Set"
["pid"]=&gt;
string(16) "Q-SCAN-EXPANSION"
["required"]=&gt;
array(1) {
["id"]=&gt;
string(5) "FALSE"
}
["data"]=&gt;
array(3) {
["img"]=&gt;
int(1)
["tag"]=&gt;
string(3) "exp"
["vdo"]=&gt;
string(5) "FALSE"
}
}
["shipping"]=&gt;
array(5) {
["freight"]=&gt;
string(5) "FALSE"
["oval"]=&gt;
string(9) "0.00/0.00"
["unit"]=&gt;
string(5) "FALSE"
["ship"]=&gt;
string(5) "FALSE"
["mast"]=&gt;
string(5) "FALSE"
}
}
}
... etc
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 03.2010 — No luck...[/quote]

Fair enough. Using your actual values, your code is doing this (psuedo code):

[B]if (0107 does not equal QBM or 0107 does not equal 0107) { do this }[/B]

:p

Are you using valid test values, or is this the logic you want? Now that I spelled it out, it might be more clear to you what you want. I hope.

-jim
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 03.2010 — You posted some more stuff while I was replying, but seems to just confirm the test values you posted here. So look at the psuedo code I posted and you'll see the result of the if condition is false (T + F = F)
Copy linkTweet thisAlerts:
@ehimeauthorJun 03.2010 — It's pretty close to what I'm trying to get.

[B]if ($this_value does not equal QBM

AND [/B]
[B]$this_value[/B][B] does not equal 0107)

{ some_function() }[/B]


It still returns false though?

[code=php]
$this_value = 'this';
if ($this_value != 'this' || $this_value != 'that') { /* T + F = F still yes? */ }

But

if ($this_value != 'this' && $this_value != 'that') { /* T + F = T now correct? */ }
[/code]


I can't understand why my code won't do this though, I've tried it both ways.

It chokes, sputters, then dies. It's ridiculous.
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 04.2010 — In reply #2 you set the value of [COLOR=#000000][COLOR=#007700][/COLOR][COLOR=#0000bb]$file [/COLOR][COLOR=#007700]the same as [/COLOR][COLOR=#0000bb]$product[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000bb]$k[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'code'[/COLOR][COLOR=#007700]] (each being 0107). That's why I asked if either your test data was wrong or your condition should have been "and" instead of "or". To me the test data is silly being the same like that, but it's your data and its meaning is only relevant to you, not me. I'm just pointing out what's really going on with that if condition hoping a lightbulb will click on, and you'll know what to do.

[/COLOR]
[/COLOR]
Copy linkTweet thisAlerts:
@criterion9Jun 04.2010 — It's pretty close to what I'm trying to get.

[B]if ($this_value does not equal QBM

AND [/B]
[B]$this_value[/B][B] does not equal 0107)

{ some_function() }[/B]


It still returns false though?

[code=php]
$this_value = 'this';
if ($this_value != 'this' || $this_value != 'that') { /* T + F = F still yes? */ }

But

if ($this_value != 'this' && $this_value != 'that') { /* T + F = T now correct? */ }
[/code]


I can't understand why my code won't do this though, I've tried it both ways.

It chokes, sputters, then dies. It's ridiculous.[/QUOTE]

Not quite....
[code=php]
$this_value = 'this';
if ($this_value != 'this' || $this_value != 'that') { /* F or T = T */ }

But

if ($this_value != 'this' && $this_value != 'that') { /* F & T = F */ }
[/code]
Copy linkTweet thisAlerts:
@ehimeauthorJun 04.2010 — [COLOR=#000000][COLOR=#007700] I'm just pointing out what's really going on with that if condition hoping a lightbulb will click on, and you'll know what to do.

[/COLOR]
[/COLOR]
[/quote]


It's not, I'm still having trouble with this mess. ?
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 04.2010 — You're not surprised your code does this:

[B]if (0107 does not equal QBM or 0107 does not equal 0107) { do this }



???



Let me summarize...



[/B]
Look at those values.... either your test data is wrong or your if condition doesn't do what you want. Try not to think in code, but in psuedo code like I did -- what values *should* be used, and what should the if condition look like in psuedo code, different from mine?

Until you tell us in English what you expect to happen, and confirm the proper variables are being plugged into the if condition, we can only show you the true/false logic you're using so far. We can't "fix" errors in logic, you need to tell us the logic you expect, then we can use that to help you turn it into code.

-jim
Copy linkTweet thisAlerts:
@ehimeauthorJun 04.2010 — Well Jim its pretty simple what I want.

If the product is not a short name in

the XML (aka QBM) or a product code

in the XML (QBM's is 0107 for instance)

I want it to run my attempted() function

to email me that someone is snoop around

my webpage. It should be pretty cut and

dry, but it's seriously screwing up my code

for no apparent reason. The && should

have worked, but it doesn't and I can't

figure out why not.
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 04.2010 — Well Jim its pretty simple what I want.

If the product is not a short name in

the XML (aka QBM) or a product code

in the XML (QBM's is 0107 for instance)

I want it to run my attempted() function

to email me that someone is snoop around

my webpage. It should be pretty cut and

dry, but it's seriously screwing up my code

for no apparent reason. The && should

have worked, but it doesn't and I can't

figure out why not.[/quote]


That's your logic.

Now, when plugging in real world values, the "product" [B]was[/B] "a short name in the product code in the XML" (the second half of your if condition). That resulted in [B]false[/B] since you use "did not equal" there. The script skipped the attempted() function exactly as instructed.

If the logic is correct, then the values are unexpected or wrong (issue with how $files or more likely $product[$k]['items']['data']['tag'] was populated with data, or wrong variable).

Again, the logic and values are meaningful only to you. I'm still hoping by taking the time to show you what the script is seeing will help you realize where you might have missed something -- or maybe didn't, and the data is simply wrong.

This is my final response because it's getting repetitive and my brain is melting too.

-jim
Copy linkTweet thisAlerts:
@ehimeauthorJun 04.2010 — I figured it out, I am running through MULTIPLE matches, so the first time

it doesn't match it overrides the program. I have to figure out a loop that

says [b]if any of these match do this[/b] otherwise we're good to go.

Sorry to strain you jim, you've been a big help. You were right, there was

something I'd completely overlooked.
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 04.2010 — Excellent! I knew something would click eventually -- sometimes it just takes a little time to work things out using logic (psuedo code). Cheers. ?
Copy linkTweet thisAlerts:
@criterion9Jun 04.2010 — I figured it out, I am running through MULTIPLE matches, so the first time

it doesn't match it overrides the program. I have to figure out a loop that

says [b]if any of these match do this[/b] otherwise we're good to go.

Sorry to strain you jim, you've been a big help. You were right, there was

something I'd completely overlooked.[/QUOTE]


So basically in pseudocode?
<i>
</i>if($condition1 || $condition2 || $condition3){
//do this one thing
} else {
//do the other thing
}
Copy linkTweet thisAlerts:
@SrWebDeveloperJun 04.2010 — Here's a quick example of psuedo notational style for common coding algorithms:

[CODE]<variable> = <expression>

if <condition>
do stuff;
else
do other stuff;

while <condition>
do stuff;

for <variable> from <first value> to <last value> by <step>
do stuff with variable;

function <function name>(<arguments>)
do stuff with arguments;
return something;

<function name>(<arguments>) // Function call
[/CODE]


It's purpose is for human reading and comprehension, not machine. It helps developers solve logic and even syntax issues in code by removing variables and actual data which can clutter the mind. It also is excellent to present an algorithm to lay people during design phase.

Just a tool in the toolbox, I didn't follow psuedo notation to the letter of the law, but it did help the OP see how data was being inserted into the condition, and how the condition was behaving. Or something like that!

-jim
×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...