Current location: Hot Scripts Forums » Programming Languages » PHP » Deleting information


Deleting information

Reply
  #1 (permalink)  
Old 01-15-04, 02:51 AM
Gtwy Gtwy is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Pittsburgh, Pennsylvania, USA
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Deleting information

Let's say that I have $something and it is exploded into like a ton of different parts. How can I write a code that searches through each [] and finds all the exploded parts containing a certain phrase and totally wipe it out?


Also, what is the code to make php count all of the lines in a text document?



Sorry bout my stupid questions, I'm new to PHP. :-[


Thanks in advance,
James Watt
Reply With Quote
  #2 (permalink)  
Old 01-15-04, 03:21 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

I would perhaps run a loop in which I compare the specified value (search string) to each exploded-array's value. If matched, then unset it from the array, and in the end, you'll get an array with the specified values deleted.

OR

You can perhaps use array_search() function to do the same trick:

PHP Manual: array_search()
http://ca.php.net/manual/en/function.array-search.php



In reply to your second question, you can do something like this:

PHP Code:

$lc count(file('/path/to/yourfile.ext')); 

file() takes each line of a specified file as an array value, and count this value and assign this number to the var $lc, then you'll get a line count.

HTH.
__________________
Blavv =|
Reply With Quote
  #3 (permalink)  
Old 01-15-04, 02:50 PM
Gtwy Gtwy is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Pittsburgh, Pennsylvania, USA
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
You're awesome. Thanks. :-D
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
form not inserting information into the database sabret00the PHP 7 12-01-03 03:35 PM
Validating information? tcooper PHP 1 11-20-03 12:51 PM
Just learning: how do I update information in table? paulj000 PHP 3 08-07-03 10:49 AM
Help Transfering information praeclarus PHP 1 07-24-03 06:03 PM
script to grab any information ? xgab PHP 5 06-22-03 10:33 AM


All times are GMT -5. The time now is 08:29 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.