You are here: Re: Newbie: Trouble trying to use strpos(target, bigstring) « PHP Programming Language « IT news, forums, messages
Re: Newbie: Trouble trying to use strpos(target, bigstring)

Posted by Robert Maas, see http://tinyurl.com/uh3t on 06/29/05 05:51

> From: "Philip Olson" <philipolson@gmail.com>
> You have the parameter order mixed up, switch $ipconst and $qs.

Aha! Thanks much! I think I know the problem: The tutorial kept talking
about finding needle in haystack, so in my mine it was "needle in
haystack", "needle ... haystack", "strpos(needle haystack)"
"strpos($needle, $haystack);" and so I was blind to the example in
reversed order, sigh. I have a suggestion for anyone writing such a
tutorial: Emphasize that the order is reversed from the cliche, or use
a different cliche which has the correct sequence, such as:
I'll be searching $Everywhere, looking for $SomeoneWhoCares
Going to $KansasCity, looking for some $CrazyWomen

Anyway, thanks to your key help for this sometimes Homer Simpson, I was
able to finish my hello-world-plus-two-steps:
http://www.rawbw.com/~rem/HelloPlus/hellos.html#php2

> Also, consider stristr() for case insensitive version.

Hmm, ugly extracting a whole substring to end of big string just to see
whether the initial prefix of that extracted substring was present, but
oh well the overhead of HTTP/Apache/PHP/disk is probably much larger so
for this quick demo that PHP can achieve two steps past Hello World (be
responsive to user input/selections) it's good enough. Done in demo
cited above, i.e.
http://www.rawbw.com/~rem/HelloPlus/hellos.html#php2
which links to the actual PHP file:
http://www.rawbw.com/~rem/HelloPlus/h2.php
but please do look at the hellos.html file if you're curious, such as
the subtle way that HTML by itself has to cheat to almost reach this
level:
http://www.rawbw.com/~rem/HelloPlus/hellos.html#html2

OK, I finished composing that many hours ago, but decided to include C
and C++ among my one-step-beyond-hello-world examples, had some trouble
with return type of getenv in C, because stupid C compiler failed to
tell me I had failed to include the header for standard library so it
was undefined function assumed to return type int, sigh. Anyway, hours
later after browsing stuff I found the answer and fixed it, and went
ahead to convert to C++ and do that too, all working just like PHP now.

So sorry for my not posting this to thank you about 9 hours ago when I
first got the PHP stuff working and composed the main part. But thanks
again! Please see all my examples of one-step-beyond-hello-world here:
http://www.rawbw.com/~rem/HelloPlus/hellos.html#step1
php sh* perl python lisp c c++ java
Shortly I'll be posting a challenge to comp.programming asking if
anybody's favorite WebServer application-programming language isn't
listed there. Watch for it if you're curious...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация