Jump to content

troubles with split function


mike16889

Recommended Posts

im trying to make a script to mass replace the start of some urls. they are to be submitted into a text input box (seporated onto 1 URL per line). but i can't seem to get it to work. i'm sure its simple but hey, i'm a bigginer!

 

<?php
$urls = $_POST['urls'];

$x = 0;

$array = split('\n\r', $urls);

$arraysize = count($array);

echo $arraysize;

while ($x < $arraysize){

	echo '<p>'.$array[$x].'</p><p>'.$x.'</p>';

	$pos = strrpos ($array[$x], "domain.com");

	$urla = str_split($array[$x], $pos);

	echo '<p>'.$array[$x].'</p>';
	$x++;
	echo '<p><a href="'.$urla[1].'">Link '.$x.'</a></p>'; 
}
?>

 

well there it is, can't think of anything else i need to tell you exept that its not actualy spliting the stuff up into new lines.

Link to comment
https://forums.phpfreaks.com/topic/112734-troubles-with-split-function/
Share on other sites

Cool that worked but now for some reason its spliting the urls up into chunks of 7 charicters. not rly a problem i just put the following string in

echo '<p><a href="http://'.$username.':'.$password.'@'.$urla[1].$urla[2].$urla[3].$urla[4].$urla[5].$urla[6].$urla[7].$urla[8].$urla[9].$urla[10].$urla[11].$urla[12].$urla[13].$urla[14].$urla[15].$urla[16].$urla[17].$urla[18].$urla[19].$urla[20].$urla[21].$urla[22].$urla[23].$urla[24].$urla[25].$urla[26].$urla[27].$urla[28].$urla[29].$urla[30].$urla[31].$urla[32].$urla[33].$urla[34].$urla[35].$urla[36].$urla[37].$urla[38].$urla[39].$urla[40].'">Link '.$x.'</a></p>'; 

but it someone has a solution id like to here it!

 

THANKS effigy

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.