note 10777 deleted from function.eregi by jimw

From: Date: Fri, 02 Nov 2001 02:04:32 +0000
Subject: note 10777 deleted from function.eregi by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20228@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!"

« previous php.notes (#20228) next »