New, User, Noob Question

0 Jake M. · October 4, 2014
Hi guys, 

I recently started taking a PHP course (offline) and we've, so far, gone through the basic theoretic stuff about it and have now moved on to the first bits of code. I've had no prior HTML/CSS experience and no coding experience whatsover. 

I decided to get an overview on those languages and managed to pick things up in an amusing and useful way, thanks to Bucky's YT tutorials. :) 

Now, I'm stuck with an assignment from the course and I was hoping to get some help here. 
Using variables, I have to write out:
Name
Last name
Phone
City
Address 
all in one row, with commas between each variable. 


Then I should get the character count for each result.


Finally, I need to extract the first letter of my name and last name, in order to get the initials.


Could I get any guidelines from you guys on this?

Thanks,
Jake

Post a Reply

Replies

Oldest  Newest  Rating
+1 Samuel Oloruntoba · October 4, 2014
If i understand your question, here is what you need


$name = "Firstname";
$lastname = "Lastname";
$phone = "555-2214";
$city = "New York";
$address = "13th and somewhere";

// print on one line seperated by commas
$one_line = "$name, $lastname, $phone, $city, $address";

print( $one_line );

// extract initials
$initials = $name[0] . '.' . $lastname[0];

print( $initials );


// to get the count just use the function strlen and pass in the string


0 Jake M. · October 4, 2014
Yeah, that's what I needed. Thanks a lot for the help!
  • 1

PHP

107,224 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators