Is this code right?
PHP Code:$LEVEL = $data[27753], $data[27754], $data[27755], $data[27756], $data[27757], $data[27758], $data[27759], $data[27760];
Printable View
Is this code right?
PHP Code:$LEVEL = $data[27753], $data[27754], $data[27755], $data[27756], $data[27757], $data[27758], $data[27759], $data[27760];
what are you trying to do?
If you're trying to concatenate them, you will have to use a "." (fullstop - no quotes) to do this
this
or thisPHP Code:$LEVEL = $data[27753] . $data[27754] . $data[27755] . $data[27756] . $data[27757] . $data[27758] . $data[27759] . $data[27760];
both do the samethingPHP Code:$LEVEL = {$data[27753]} {$data[27754]} {$data[27755]} {$data[27756]} {$data[27757]} {$data[27758]} {$data[27759]} {$data[27760]};
Thanks for all the help...
However, maybe you could help me out some more?
I am using the code at the top of this thread to find out what the letters are at the $data[xxxxx] possitions in an html file.
is there a better way to find a specific word or string in an html?
i.e. look for {color} or <img src="/images/file.jpg">
what code?
all you have is numbers. how is that finding a string in a html document?
plus depending on how you are dioing it, you can open the html page up in fopen() and search for the string.
this is exactly what I'm using
What I now need to know is; Is there a better (not necessarily easy) way to find a string such as <img src="/images/file1.jpg">,PHP Code:<?php
$fp = fopen("http://www.boogiebug.com/folder/index.html", "r");
$data = "";
while(!feof($fp))
{
$data .= fgets($fp, 4096);
}
if ($data[27753] . $data[27754] . $data[27755] . $data[27756] . $data[27757] . $data[27758] . $data[27759] . $data[27760] . $data[27761] . $data[27762] . $data[27763] . $data[27764] == 'file1.jpg')
{
$LEVEL = "file1.jpg";
}
else {
$LEVEL = "Oops";
}
echo $LEVEL;
?>
so I can dynamicly change which image is displayed on my page according to what is displayed on the other page?
where do you get those numbers???
$data[27753]
don't tell me you are counting all the lines? that is totally wrong.
if you want to find a <img> tag then use regular expression.
something like that. what worrry about numbers.PHP Code:$fp = fopen("http://www.boogiebug.com/folder/index.html", "r");
$arrlen = count($fp);
fclose($fp);
$length = count($newArray);
for ($j = 0; $j <$length ; $j++) {
if (preg_match ('/^[file1.jpg]/i', $fp[$j], $matches)) {
$LEVEL = "file1.jpg";
} else {
$LEVEL = "Oops";
}
echo $LEVEL;
not tested but should work.
Yeah, use the strstr()-function.
You can find out more at http://www.php.net/manual/en/function.strstr.phpPHP Code:$string = '<img src="/images/file1.jpg">';
$container = $data;
if(strstr($container,$string)) {
$LEVEL = "your-file";
} else {
$LEVEL = "you-missing-file";
}