Jump to content

Convert shortname to fullname ?


jani

Recommended Posts

Hello all, i am new here :)

 

..i was thinking of a function i could use, but i don't really know where to start...

 

I have "shortnames" for items listed in a database, and i am seeking a way to connect a "shortname" to a "fullname".

I would not like to have the equivalent for the shortname in the database, but just have a function in php where i can feed "shortname" and it will then

return me the "fullname".

 

 

Example:

 

if ($shortname="STREET1")

{

  $fullname="The Very Long Name of the Street1";

}

 

if ($shortname="STREET2")

{

  $fullname="The Even Longer Name of the Street2";

}

 

... this is how i can get it working, but isn't there a simplier way to do this?

 

One solution is of course to make a function, that has all the IF-statements(20-25), and then i just throw in the shortname and it will return the fullname.

 

 

Is it possible to use strings or something like this;

 

STREET1:"The Very Long Name of the Street1"

STREET2:"The Even Longer Name of the Street2"

 

And then build a function of it ?

 

 

All shortnames and fullnames occure only once, i.e. no streets with the same short/fullname.

 

Example code appreciated.

 

TIA

/Jani

 

Link to comment
https://forums.phpfreaks.com/topic/106462-convert-shortname-to-fullname/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.