0

If i have a textfile called text.txt, inside the textfile at column 2 line 6 there is one word "help" how do i read that word and print it out with php/html?

2 Answers2

2

With HTML it is impossible. You need to use PHP or other language.

Using PHP

<?php
$arr = file ("text.txt");
substr($arr[5],2,4);
?>

or if you want exact word to be found.

<?php
$arr = file ("text.txt");
preg_match('/help/', $arr[5], $matches);
print_r($matches);
?>

http://php.net/manual/en/function.substr.php

http://php.net/manual/pl/function.file.php

http://pl1.php.net/manual/en/function.preg-match.php

Robert
  • 18,927
  • 5
  • 54
  • 81
0

Need to use php like here: http://www.html.net/tutorials/php/lesson15.php Just insert php code inside your html page. Use array and string operations to do what you need.

Halabella
  • 59
  • 3
  • 7