-2

The code looks like this:

$link .= '/'. . 'elevi' . .'/'. $clasa . '/' . $litera . '/' .  $nume .'-'. $prenume;

But the error apear :

Parse error: syntax error, unexpected '.' in ...

But if the code looks like this :

$link .= $clasa . '/' . $litera . '/' .  $nume .'-'. $prenume;

Works like this :

11/c/bobo-alex

and i want it to looks like this

./elevi/11/c/bobo-alex

with [dot] and slash first

Mohammad
  • 21,175
  • 15
  • 55
  • 84
Rares Coco
  • 11
  • 5

2 Answers2

0

You have to many string combining dots in your first segment.

You can also use "" instead of '' for PHP to auto-echo variable contents to the string.

$link .= "./elevi/$clasa/$litera/$nume-$prenume";
Mark Phillips
  • 273
  • 1
  • 8
0

The dots are used to concatenate two strings, so you can't put two dots consecutive, it will rise a syntax error, so you can do it in two ways:

$mystring = './' . $var1 . '/' . $var2 . '/' . $var3 . '-' . $var4;

or:

$mystring = "./$var1/$var2/$var3-$var4";
Cesar
  • 707
  • 3
  • 13