Re: [PHP] newbie q: how to count words in a file
Thank you.. figured it out now. Tauntz Khalid El-Kary wrote: Use file system functions to get the contents of the file in a string, then us substr_count() on that string. Filesystem: http://www.php.net/manual/en/ref.filesystem.php substr_count: http://www.php.net/manual/en/function.substr-count.php Regrads Khalid Al-kary Hi ! I'm new to php and I have not found a solution for my problem (dumb me) ok.. here we go... I have a file.. it's content is: hello, ello, llo and so on and so on ok.. and now I want to know how many "hello" words are in that file.. how can I arrange it ?:) Thanks Tauntz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie q: how to count words in a file
Hi ! I'm new to php and I have not found a solution for my problem (dumb me) ok.. here we go... I have a file.. it's content is: hello, ello, llo and so on and so on ok.. and now I want to know how many "hello" words are in that file.. how can I arrange it ?:) Thanks Tauntz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: how to get names of files...
Thank you, I got it working :) -Original Message- From: Henrik Hansen [mailto:[EMAIL PROTECTED]] Sent: 25. juuni 2002. a. 15:04 To: [EMAIL PROTECTED] Subject: [PHP] Re: how to get names of files... [EMAIL PROTECTED] (Tauntz) wrote: > Hello.. > > I have a problem: > > I want to get all the filenames in a folder and put each filename into a > variable.. http://dk.php.net/manual/en/function.readdir.php > (if there's a.gif in the folder then I want $first to be "a.gif", IF > there's also a "na.jpg" then I want then it should be $second .. if you > know what I mean) use some if's to find out in the readdir loop. -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to get names of files...
Hello.. I have a problem: I want to get all the filenames in a folder and put each filename into a variable.. (if there's a.gif in the folder then I want $first to be "a.gif", IF there's also a "na.jpg" then I want then it should be $second .. if you know what I mean) sry for the dumb question but I'm quite new to php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a quick question..
Thank you, it worked :) - Original Message - From: "Nick Wilson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 27, 2002 9:27 PM Subject: Re: [PHP] a quick question.. > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > * and then Tauntz blurted > > If I have n variables: > > $nr1 = "some text"; > > $nr2 = "some other text" > > $nr3 > > > > and I want to print the text "randomly" (like if I enter the page.. it displays $nr1... next time it displays $nr 5.. etc) > > how can I achieve it ? > > > Pop them all into an array and use array_rand() > See manual for details. > > HTH > - -- > > Nick Wilson > > Tel: +45 3325 0688 > Fax: +45 3325 0677 > Web: www.explodingnet.com > > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE8VFSFHpvrrTa6L5oRAg7iAKCAvzPSf8E5LGXOF5AjYEhwJXmqrQCfVWYE > ycfLyu31AB+QDQmkcKaJKe0= > =pkfe > -END PGP SIGNATURE- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] a quick question..
If I have n variables: $nr1 = "some text"; $nr2 = "some other text" $nr3 and I want to print the text "randomly" (like if I enter the page.. it displays $nr1... next time it displays $nr 5.. etc) how can I achieve it ? [EMAIL PROTECTED]
Re: [PHP] How do I read the first n lines from a file?
hey.. thank you.. but is it possible to read the last lets say 10 lines from a file ? - Original Message - From: "Niklas Lampén" <[EMAIL PROTECTED]> To: "Tauntz" <[EMAIL PROTECTED]>; "Php-General" <[EMAIL PROTECTED]> Sent: Tuesday, August 28, 2001 3:28 PM Subject: RE: [PHP] How do I read the first n lines from a file? > You can do this: > > $i = 0; > $fp = fopen("list.txt", "r"); > while (!feof($fp) && $i < 10) { > $i++; > $Text = fgets($fp, 4096); // Reads first 4096 characters from a row. > print "$Text\n"; > }; > > > Niklas > > -Original Message- > From: Tauntz [mailto:[EMAIL PROTECTED]] > Sent: 28. elokuuta 2001 14:13 > To: [EMAIL PROTECTED] > Subject: [PHP] How do I read the first n lines from a file? > > > hi ! > > I have a simmple question :).. > > Lets say that I have a file called: > list.txt > and I want to take the first 10 lines from it & echo it to the browser ? > > thank you > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How do I read the first n lines from a file?
hi ! I have a simmple question :).. Lets say that I have a file called: list.txt and I want to take the first 10 lines from it & echo it to the browser ? thank you [EMAIL PROTECTED]