Jump to content

Help really needed - loop, is_numeric and txt file


nudo01

Recommended Posts

Hi guys! I really need your help...  :'(

 

I'm new to PHP and I need to make a code like this:

 

List of towns (names both finnish and swedish) and their town codes.

 

I've made it this far.

 

<?php
$a = file_get_contents("suomi.txt"); //hakee datan
$b = file_get_contents("ruotsi.txt");
$a = str_replace(array("\r\n" , "\t") , array("[uusi rivi]" , "[tab]") , $a); //määrittää rivinvaihdon ja tabin
$b = str_replace(array("\r\n", "\t") , array("[uusi rivi1]", "[tab1]"), $b);
foreach( explode("[uusi rivi]" , $a) as $viivat) { //looppaa "suomi.txt"
	print "<tr>";
	foreach( explode("[tab]" , $viivat) as $lista) {
		print "<td>";
		print $lista;
		print "</td>";
	}	
}

print "</tr>";
?>

 

So I need another loop code that doesn't import town codes, only swedish names. I have to use functions like intval, is_numeric etc but I can't understand any of the manuals.

 

Thank you.

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.