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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.