You are here: Re: compare « PHP SQL « IT news, forums, messages
Re: compare

Posted by <talthen.z-serwera.o2 on 04/09/06 23:53

"Piet" <p.potjer@hccnet.nl>
> How can I stop a function in PHP?
>
> When comparing data I want to stop the function on a hit.
> Function compare($data) {
>
> For ($n=1; $n<=10000; $n++) {
> For ($m=1; $m<=10000; $m++) {
> If $data[$n]==data[$m] {
> .
> Exit function, or exit for.. --- but how?
> }
> }
> }

1. "Function", "If" and "For" should be lowercase
2. To break a loop- "break;"
3. To exit from function: "die('message explainging the reason');". You can
use "exit()" alias or just "return 0;".
4. For string comparison you can use substr_compare- should be much faster
then comparing byte by byte in a loop
5. NTG :)

Regards,
Talthen

 

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

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