How can I edit elemet in array -> $vstup[1][1]='m' ? That's not how it works. The element on [1] [1] is still '.'
<?php
$string= '.....
.....
.XXX.
.....
.....';
$vstup=explode("\n",$string);
$pocetRadku = count($vstup);
for($i=0; $i<$pocetRadku; $i )
{
$vstup[$i]=str_split($vstup[$i]);
}
/* with \n */
$pocetSloupcu = count($vstup[0]);
/* delete \n */
for($i=0; $i<$pocetRadku-1;$i )
{
unset($vstup[$i][$pocetSloupcu-1]);
}
$vstup[1][1]=='m';
print_r($vstup);
CodePudding user response:
Instead of
$vstup[1][1]=='m';
Use
$vstup[1][1] = 'm';
Not 2 equlas sign, use just one = for assignment.