note 39261 deleted from function.split by didou

From: Date: Thu, 22 Jan 2004 13:02:40 +0000
Subject: note 39261 deleted from function.split by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-64015@lists.php.net to get a copy of this message
Note Submitter: biohazard@online.ge ---- for the first times it was difficult to learn the use of RegXP and i wrote some these coool and easy functions for strings... eg. use AFTER to determinate what is after '=' in 'max_urls=14' the result is '14' and so on, on other ones.... OR use BETWEEN to determinate what is between '(' and ')' in 'sin(90)' result is '90' function after ($this, $inthat) { if (!is_bool(strpos($inthat, $this))) return substr($inthat, strpos($inthat,$this)+strlen($this)); }; function after_last ($this, $inthat) { if (!is_bool(strrevpos($inthat, $this))) return substr($inthat, strrevpos($inthat, $this)+strlen($this)); }; function before ($this, $inthat) { return substr($inthat, 0, strpos($inthat, $this)); }; function before_last ($this, $inthat) { return substr($inthat, 0, strrevpos($inthat, $this)); }; function between ($this, $that, $inthat) { return before($that, after($this, $inthat)); }; function between_last ($this, $that, $inthat) { return after_last($this, before_last($that, $inthat)); }; //this function is required: function strrevpos($instr, $needle) { $rev_pos = strpos (strrev($instr), strrev($needle)); if ($rev_pos===false) return false; else return strlen($instr) - $rev_pos - strlen($needle); };

« previous php.notes (#64015) next »