substring - PHP - variable using substr() cant be extended -
i'm creating account-system. user gives first name & last name. create record in database first letter of first name , full last name.
to first letter in code:
$first_letter = substr($voornaam, 0, 1); echo "eerste letter-variabele: "; var_dump($first_letter); echo "<br/>"; $gebruiker = $first_letter; echo "overgezet in gebruiker-variabele: "; var_dump($gebruiker); echo "<br/>";
the var_dumps return want, string containing first letter of given first name.
to create 2nd part of username do:
$gebruiker += $achternaam; echo "+achternaam: "; var_dump($gebruiker); echo "<br/>";
this returns int(0) (probably boolean saying false). have searched , found nothing. assume has sub_str() still functioning (?) please show me proper way solve problem (object-oriented welcome).
use .=
in stead of +=
, work.
+
adds (as in math) ... , .
used concatenation.
now make own huiswerk... ;)
Comments
Post a Comment