Jump to content

madrazel

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

About madrazel

  • Birthday 10/16/1979

Profile Information

  • Gender
    Male

madrazel's Achievements

Member

Member (2/5)

0

Reputation

  1. yes, but the output image should have resolution 800x600 - this is simple task with any graphic editor but how to do it in php ?
  2. i have two files: 1. caption.png (800x25) 2. picture.png (800x576) is there a build in function to add caption to the picture that will return a file or image resource that will be content of one file on top the another ?
  3. i want script for automation, to write a bunch of url's to a specific folders (to save files to my local disk, not to a remote ftp location)
  4. i need something that can download whole web-page with images, styles, frames and save it all to one folder just like a web browser would do
  5. example: Array ( [0] => Array ( [0] => /styles/site.css [1] => /styles/mirror.css ) [1] => Array ( [0] => /styles/print.css ) ) i want it to be: Array ( [0] => /styles/site.css [1] => /styles/mirror.css [2] => /styles/print.css ) is there a build-in function for this ?
  6. in example: <script /*whatever here*/> /*anything between, Chinese, Korean, Arabic characters, line breaks etc..*/ </script> i done this: $str = preg_replace('/<script(\n|\t|-|[[]|[]]|[a-z0-9!?@&%*+<>(){};:,._=\'"\/| ])+<\/script>/i','', $str); but it still occasionally leaves behind some tags..
  7. not present on http://pecl.php.net/
  8. whatever, i done this: function listvars($x) { $args = explode(',',$x); ob_start(); foreach ($args as $val) { global $$val; echo '$'.$val.' = '; if (is_null($$val)) { echo "NULL"; } elseif ($$val === FALSE) { echo "FALSE"; } elseif ($$val === TRUE) { echo "TRUE"; } elseif ($$val === '') { echo "EMPTY"; } elseif (is_array($$val)) { print_r($$val);} else { echo $$val; }; echo "\n"; }; echo "<pre>\n".ob_get_clean()."</pre>\n"; }; $a="t"; $b=''; $c="h"; listvars("a,b,c");
  9. actually i got something like this in mind: $c = 'bang'; $f = 'c'; echo $$f."\n"; an now I'm struggling to make function with it, that will help me with debugging scripts
  10. like this: $f = "bang"; function listvars() { $args = func_get_args(); foreach ($args as $val) { echo $val."\n"; }; }; listvars($f,$f); gives output: bang bang how to make it display: $f $f
  11. ok, now i done it,: // x - haystack, y - needle, z - mode function strcut($x,$y,$z) { switch ($z) { case '<-': return strstr($x,$y); case '(-': return substr(strstr($x,$y),strlen($y),strlen($x)); case '->': return strrev(strstr(strrev($x),strrev($y))); case '-)': return strrev(substr(strstr(strrev($x),strrev($y)),strlen($y),strlen($x))); case '<' : return $y.strrev(substr(strrev($x),0,strpos($x,$y))); case '(' : return strrev(substr(strrev($x),0,strpos($x,$y))); case '>' : return substr($x,0,strpos($x,$y)).$y; case ')' : return substr($x,0,strpos($x,$y)); default : echo "ERROR IN STRCUT"; break;}; }; //testing $z = array('<-','(-','->','-)','<','(','>',')',); $x = '123-XY-456-XY-789'; foreach ($z as $z) { echo $z.' = '.strcut($x,'XY',$z)."\n"; } //output //<- = XY-456-XY-789 //(- = -456-XY-789 //-> = 123-XY-456-XY //-) = 123-XY-456- //< = XY-789 //( = -789 //> = 123-XY //) = 123- the question is actually about particular expresiions, i want to avoit things like these: strrev(substr(strstr(strrev($x),strrev($y)),strlen($y),strlen($x)))
  12. sorry, i forgot... function strcut($x,$y,$z) { if ($z=="<-") { return strstr($x,$y); } elseif ($z=="(-") {return substr(strstr($x,$y),strlen($y),strlen($x));} elseif ($z=="->") {return strrev(strstr(strrev($x),strrev($y)));} elseif ($z=="-)") {return strrev(substr(strstr(strrev($x),strrev($y)),strlen($y),strlen($x)));} elseif ($z=="<") {return $y.strrev(substr(strrev($x),0,strpos($x,$y)));} elseif ($z=="(") {return strrev(substr(strrev($x),0,strpos($x,$y)));} elseif ($z==">") {return substr($x,0,strpos($x,$y)).$y;} elseif ($z==")") {return substr($x,0,strpos($x,$y));} };
  13. i just made this little fella: function strcut($x,$y,$z) { if ($z=="<-") return strstr($x,$y); if ($z=="(-") return substr(strstr($x,$y),strlen($y),strlen($x)); if ($z=="->") return strrev(strstr(strrev($x),strrev($y))); if ($z=="-)") return strrev(substr(strstr(strrev($x),strrev($y)),strlen($y),strlen($x))); if ($z=="<") return $y.strrev(substr(strrev($x),0,strpos($x,$y))); if ($z=="(") return strrev(substr(strrev($x),0,strpos($x,$y))); if ($z==">") return substr($x,0,strpos($x,$y)).$y; if ($z==")") return substr($x,0,strpos($x,$y)); }; echo strcut("abcXYdefXYghi","XY",")"); it works like this: string: abcXYdefXYghi <- = XYdefXYghi (- = defXYghi -> = abcXYdefXY -) = abcXYdef < = XYghi ( = ghi > = abcXY ) = abc any ideas to improve it ?
  14. given is string: http://www.server.com/dir/dir2/dir3/file.html or myname@domain.com and result should be: http://www.server.com/dir/dir2/dir3/ or myname@ how to make it *really fast* without strrev and strstr ?
×
×
  • 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.