Forum Moderators: coopster
$lines[0]="info1";
$lines[1]="info2";
$lines[2]="info3";
$lines[3]="info4";
And i need to insert 3 (*) empty arrays on location $lines[1] (**) and everything under $lines[1] (**) it must also shift 3 (*) arrays down.
So the result would be:
$lines[0]="info1";
$lines[1]="";
$lines[2]="";
$lines[3]="";
$lines[4]="info2";
$lines[5]="info3";
$lines[6]="info4";
Is there a PHP command for this?
i couldn't find one that does exactly this. And i got a really weird error message with all weird characters, when i tried to make my own code to do this, and run it on the server.
The code i come up with was:(please don't laugh, i'm new to php, so my code is probably bad)
<?PHP
$filename = 'bestand.txt';
$lines = file($filename);
$startnummer="0";
$ruimte="1";
$teller="10";
while ($teller!=$startnummer)
{
$lines[$startnummer+$teller]=$lines[$startnummer+$teller+$ruimte];
$teller=$teller-"1";
}?>
But i got this really weird message.
Can anybody help me out?
(*) i need 3 lines and sometimes just 1 line.
(**) $lines[1] is just an example, it could also be $lines[100] where the 'blank' arrays need to be inserted.