Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:43:50+00:00 2026-05-23T04:43:50+00:00

I want to take a short string, and manipulate it in PHP so various

  • 0

I want to take a short string, and manipulate it in PHP so various parts of it can be inserted into various parts of the database.

It’s a way I want to add contact information into my system.

I use a series of short codes to denote what I want the string to do. So:

  • NC = New contact
  • DESC = A description of the contact
  • MB = A cell phone number
  • HM = A home phone number
  • BS = A business number
  • EM = An email address

So for example:

$string = "NC John Doe DESC President USA MB 555123123 HM 12341234 EM john@example.net"

And so on. I can’t see why there needs to be a limit on the length.

What would you do in PHP to make this easy? I want to add phone numbers to the phone table, emails to the email table and contacts to the contact table.

I also have short codes for updates (to add more numbers to existing contacts)

  • UPD – Update contact X
  • AMB – Add cell
  • (Axx – “A” is add)
  • I won’t bother with delete/change

$string = "UPD John Doe AMB 55512341233 AEM john2@example.net"

I know it’s a bit of an odd way to get things into a system, but it’s quick to type when I’m on the run.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:43:51+00:00Added an answer on May 23, 2026 at 4:43 am

    I Agree with Michael J.V. about using an array. It would be easy to add/change actions

    Example:

    function getAction($action) {
        $actions = array(
            'NC'    => 'New contact',
            'DESC'  => 'A description of the contact',
            'MB'    => 'A cell phone number',
            'HM'    => 'A home phone number',
            'BS'    => 'A business number',
            'EM'    => 'An email address',
        );
        return $actions[$action];
    }
    
    $selected = 'DESC';
    echo 'Action Selected: '.getAction($selected)."\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to take html, including the text and images and turn it into
I want to take a file from disk and upload it into an Oracle
Short & Sweet: How can I take the hex input of 28E02 and convert
I want to get a short string hosted on a server where I do
I know you can easily take a range of cells and slap them into
all i want to take number from phonebook of android in my application database..
I want to take a list of employees with 3 parts, employee id, last
I'm trying to parse a large number of short strings into some logical parts.
I want to take the value stored in a 32 bit unsigned int, put
We want to take XML data and convert it to an NSDictionary object, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.