User Profile

Collapse

Profile Sidebar

Collapse
trashcan
trashcan
Last Activity: Sep 17 '10, 06:41 PM
Joined: Sep 17 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • searching...

    if you want to search inside files for a word...
    thats harder. a LOT harder.
    but you can do it.
    Code:
    <?php
    	$mydir = 'dir/sub-dir';
    	$myext = '.htm';
    	foreach(glob("$mydir/*$myext") as $item) {
    		$inside = file_get_contents($item);
    		$findme   = 'my text';
    		$pos = strpos($inside, $findme);
    
    // Note our use of ===.  Simply == would not
    ...
    See more | Go to post

    Leave a comment:


  • using glob

    hey, glob is kinda like a file/directory strpos(), cept i doesnt return false, ever.

    just use it like this:

    Code:
    <?php
    $mydir = 'dir/sub-dir';
    $myext = '.htm';
    foreach(glob("$mydir/*$myext") as $item) {
      echo "<li>$item</li>";
    }
    ?>
    try it, after changing to $mydir and $myext.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...