View Full Version : help simplify a series of replace functions within each other
gilgalbiblewhee
02-08-2008, 05:43 AM
I got myself into a mess. A small mess, but enough that I need to sort this out. Is there of writing this in more simplicity?
echo str_replace("&keyword1", "<input type='text' id='kw_1_".$row['ID']."' value='&keyword1","<td><input type='text' id='txt_1_".$row['ID']."' value='".str_replace("Verse=all", "verse=all' />", str_replace("@", "", str_replace("&keyword1=@", "@", str_replace("&keyword2=@", "@", str_replace("&keyword3=@", "@", str_replace("&keyword4=@", "@", str_replace("&keyword5=@", "@", str_replace("&keyword6=@", "@", str_replace("keywordf=", "keyword6=", str_replace("keyworde=", "keyword5=", str_replace("keywordd=", "keyword4=", str_replace("keywordc=", "keyword3=", str_replace("keywordb=", "keyword2=", str_replace("keyword=", "keyword1=", str_replace("/", ",,", strtolower($row['ifr1']))))))))."@"))))))))."' />"."\n"."</td>")."\n";
oesxyl
02-08-2008, 05:58 AM
I got myself into a mess. A small mess, but enough that I need to sort this out. Is there of writing this in more simplicity?
echo str_replace("&keyword1", "<input type='text' id='kw_1_".$row['ID']."' value='&keyword1","<td><input type='text' id='txt_1_".$row['ID']."' value='".str_replace("Verse=all", "verse=all' />", str_replace("@", "", str_replace("&keyword1=@", "@", str_replace("&keyword2=@", "@", str_replace("&keyword3=@", "@", str_replace("&keyword4=@", "@", str_replace("&keyword5=@", "@", str_replace("&keyword6=@", "@", str_replace("keywordf=", "keyword6=", str_replace("keyworde=", "keyword5=", str_replace("keywordd=", "keyword4=", str_replace("keywordc=", "keyword3=", str_replace("keywordb=", "keyword2=", str_replace("keyword=", "keyword1=", str_replace("/", ",,", strtolower($row['ifr1']))))))))."@"))))))))."' />"."\n"."</td>")."\n";
$v0 = row['ifr1'];
$v1 = strtolower($v0);
$v2 = str_replace("/", ",,", $v1);
$v3 = str_replace("keyword=", "keyword1=", $v2);
$v4 = str_replace("keywordb=", "keyword2=", $v3);
$v5 = str_replace("keywordc=", "keyword3=", $v4);
$v6 = str_replace("keywordd=", "keyword4=", $v5);
$v7 = str_replace("keyworde=", "keyword5=", $v6);
$v8 = str_replace("keywordf=", "keyword6=", $v7);
$v9 = str_replace("&keyword6=@", "@", $v8 ."@");
$v10 = str_replace("&keyword5=@", "@", $v9);
$v11 = str_replace("&keyword4=@", "@", $v10);
$v12 = str_replace("&keyword3=@", "@", $v11);
$v13 = str_replace("&keyword2=@", "@", $v12);
$v14 = str_replace("&keyword1=@", "@", $v13);
$v15 = str_replace("@", "", $v14);
$v16 = str_replace("Verse=all", "verse=all' />", $v15);
echo str_replace("&keyword1", "<input type='text' id='kw_1_".$row['ID']."' value='&keyword1","<td><input type='text' id='txt_1_".$row['ID']."' value='". $v16 ."' />"."\n"."</td>")."\n";
best regards
gilgalbiblewhee
02-08-2008, 07:29 AM
Thanks. But I thought I would be able to figure out what's wrong but can't.
There's a " />" missing from the value of
<td><input type='text' id='txt_1_1' value='book=1&chapter=1&verse=all<input type='text' id='kw_1_1' value='&keyword1=make,,man,,image,,like,,creeping%20thing&keyword2=god,,creat' /></td>
<td><input type='text' id='txt_2_1' value='book=45&chapter=1&verse=all<input type='text' id='kw_2_1' value='&keyword1=make,,man,,image,,like,,creeping%20thing&keyword2=god,,creat' />
</td>
oesxyl
02-08-2008, 08:07 AM
try to give some value to row['ifr1'] and $row['ID'] and see output.
best regards
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.