note 10777 added to eregi

From: Date: Sun, 21 Jan 2001 23:16:02 +0000
Subject: note 10777 added to eregi
Groups: php.notes 
Request: Send a blank email to php-notes+get-10054@lists.php.net to get a copy of this message
A cool thing to do with eregi is pass variables from an HTML file to a PHP script using HTML-style tags: function FgetStr($path, $datatype) { $pagefile = fopen($path, "r"); $data = fread($pagefile, filesize($path)); if (eregi("<" . $datatype . ">(.*)</" . $datatype . ">", $data, $out)) { $outdata = $out[1]; } return $outdata; } Now on your HTML page, you can put in <foo>Hello world!</foo>, then in your PHP say $foo = FgetStr("bar.html", "foo"); Now $foo = "Hello world!" http://www.php.net/manual/en/function.eregi.php

« previous php.notes (#10054) next »