Jump to content

tuuga

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by tuuga

  1. i use this function [CODE] //$catName -- string ex: './pictures/' //$allowTypes (optional) - set file types -- array ex: $allowTypes = array('jpg', 'gif'); function openPics ($catName, $allowTypes=NULL) { //open catalog $open = opendir($catName); //check every file while (false !== ($file = readdir($open))) { if ($file != '.' && $file != '..' && !is_dir($file)) { $ex = explode('.', $file); //if allowTypes is set if (isset($allowTypes)) { //if is right type $type = $ex[count($ex)-1]; if (in_array($type, $allowTypes)) { $pictures[] = $file; } } //take all file names in array else { $pictures[] = $file; } } } return $pictures; closedir($open); } [/CODE]
  2. or [CODE] <?php function highlight($str, $rep) {         $begin = '<span style="background-color:yellow">';         $end = '</span>';         $color = $begin.$rep.$end;         return eregi_replace($rep, $color, $str); } $str = 'some text, some text, some text, some text, some text, some text'; $strRep = 'some'; $str = highlight($str, $strRep); echo $str; ?> [/CODE]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.