Jul 24, 2008

Php Strings Tutorial - Using Strings To Avoid Repitition

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

free web hosting

Php Strings Tutorial - Using Strings To Avoid Repitition

Unholy Prayer
One of the useful features of PHP is strings. You can use them to print a long text item that you may be posting more than once. It doesn't have to be long, though. Here is an example.

<?php

$motto = "Free Web Hosting, No Ads.";
$site = "Trap17";

?>

That bit of coding could be used in a piece of text such as:

QUOTE
<?php echo "Welcome to $site. "; ?>


You can also use strings to make database functions shorter or easier to read. I'll get into that later.

I hope this tutorial was helpful to you guys.

Reply

matak
Strings can also be created as arrays like this

CODE
<?php

$information[name] = array (
                    "ivan" => "ivanovich",
                    "marko" => "markovich",
                    "petar" => "petrovich"
                    );
    
foreach ($information[name] as $key_name => $key_surname) {
    
    echo '<b>Name: </b>'.$key_name.' <b>Surname: </b>'.$key_surname.'<br>';
    
}

?>

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php strings strings avoid repitition

  1. How To Avoid The Bandwidth Robbery - How to avoid the bandwidth robbery (22)



Looking for php, strings, strings, avoid, repitition

Searching Video's for php, strings, strings, avoid, repitition
advertisement



Php Strings Tutorial - Using Strings To Avoid Repitition



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE