PS Re: Function inop, but tosses no errors



PS Target: PHP 5.2.2 on remote server, using 5.2.5 locally on winXP Pro.
Sorry for the omission.

HI,

Below is fully functional, non-functional code :^): In other words,
it works, but it doesn't do anything and darned if I can see why. None
of the 3 $email assignments result in any output. I just kept
two commented out so I could easily switch addresses for testing,
thus the "#"s. It does not kick out any errors and syntax checks
valid with tswebeditor (freebie).

I've sprinkled some echoes here and there to try to see what's running
but no help. I've indicated the ones that DO echo properly for me
with <-------.
I've checked syntax and pairing of brackets etc. in two differend
IDEs and all looks OK.
But, I've obviously pulled something stupid somwehere. It's pretty
simple code and I think it's evident what's going on so I haven't yet
added many comments. Basically, check the length left and right, how
many DOTs and @, and no dots where they shouldn't be.
But none of the if's result in any output & don't seem to be getting
run, indicating something pretty obvious I'm sure, just not obvious to
me!

Any Help?

Twayne


---------------------
<?php
$email="mine@xxxxxxxxxx";
#$email="a@xxx";
#$email=".mine.@.domain..com";
echo "<br/>KB PFSTART"; <------- PFSTART etc are just ts names,
nothing more.
echo '<br/>using: ' . $email; <------- shows email address correctly


function validateEmail($email){
$output = "Might be valid.";
$email = trim($email);

If ((strlen($email)<5) || strstr($email," "))
{
$output = "too short, " . strlen($email) . " characters.";
echo "<br/>KB PF7";
}
If (substr_count($email, "@")<>1)
{
$output = "<> one @.";
echo "<br/>KB PF6";
}
Else
{
If (strlen($halves[0])<1 || strlen($halves[1])<=3)
{
$output = "too few characters.";
echo "<br/>KB PF5";
}
echo "<br/>KB PF3";
If (substr($halves[0],0,1)=="." || substr($halves[0],-1,1)==".")
{
$output = " dot just before teh @.";
echo "<br/>KB PF5";
}
If (substr($halves[1],0,1)=="." || substr($halves[1],-1,1)==".")
{
$output = " dot on end of tld";
echo "<br/>KB PF5";
}
if (!strstr($halves[1],".") || strstr($halves[1],".."))
{
$output = " wrong number of dots in it.";
echo "<br/>KB PF5";
}
echo "<br/>KB PF7";
}
return $output;
}
echo '<br/>$output is ' . $output; # <--- $OUTPUT DOES NOT ECHO
echo "<br/>KB PFEND"; <-------

--------- end ------------------



.



Relevant Pages

  • Resolved Re: Function inop, but tosses no errors
    ... Below is fully functional, non-functional code:^): In other words, ... of the 3 $email assignments result in any output. ... I've checked syntax and pairing of brackets etc. in two differend ... many DOTs and @, and no dots where they shouldn't be. ...
    (comp.lang.php)
  • PS Resolved Re: Function inop, but tosses no errors
    ... Below is fully functional, non-functional code:^): In other words, ... None of the 3 $email assignments result in any output. ... I've checked syntax and pairing of brackets etc. in two differend ... many DOTs and @, and no dots where they shouldn't be. ...
    (comp.lang.php)
  • Function inop, but tosses no errors
    ... Below is fully functional, non-functional code:^): In other words, it ... the 3 $email assignments result in any output. ... I've checked syntax and pairing of brackets etc. in two differend ... many DOTs and @, and no dots where they shouldn't be. ...
    (comp.lang.php)
  • Re: dot turns into underscore in form data
    ... "Peter Ballard" wrote in message ... > I've seen some weird behaviour where PHP (I think PHP is the ... > culprit) turns dots into underscores in the names in my form data. ... > (I am running Apache on a RH9 Linux machine; ...
    (comp.lang.php)
  • dot turns into underscore in form data
    ... I've seen some weird behaviour where PHP (I think PHP is the ... culprit) turns dots into underscores in the names in my form data. ... (I am running Apache on a RH9 Linux machine; ...
    (comp.lang.php)