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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -