Note Submitter: mikael dot risenfors at hotmail dot com
----
Since I've found no function for getting variables out of a text (i.e. you have a .txt-file full of "id=22&name=Mikael&age=18&sex=male" and want only the age), I made a simple (but confusing) function.
Import the whole text into variable $textpage and call function through:
<?php
txtVariable($textpage, $wantedVariable);
?>
which calls function:
<?php
function txtVariable($wholeText, $vari){
echo(substr($wholeText, strpos($wholeText,
$vari."=")+strlen($vari)+1,strpos($wholeText,
"&",strpos($wholeText,$vari."="))-
strpos($wholeText,$vari."=")-strlen($vari)-1));
}
?>
Example:
<?php
txtVariable("name=Mikael&age=18&rating=fail", "age");
?>
would return 18
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.