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 8275641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:08:24+00:00 2026-06-08T08:08:24+00:00

i have an array say array1(asd,ard,f_name,l_name) now i want to replace some value as

  • 0

i have an array say
array1(asd,ard,f_name,l_name)
now i want to replace
some value as

asd with agreement start date

f_name with first name.

l_name with last name.

what i have done is this, but it is not checking for second if condition

  for($i = 0; $i < count($changedvalue);$i++){
  //Check if the value at the 'ith' element in the array is the one you want to change
//if it is, set the ith element to some value
if ($changedvalue[$i] == 'asd')
   {$changedvalue[$i] = 'Agreement Start Date';}
   elseif ($changedvalue[$i] == 'ard')
   {$changedvalue[$i] == 'Agreement Renewal Date';}
 }
  • 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-06-08T08:08:25+00:00Added an answer on June 8, 2026 at 8:08 am

    The problem with your current code is that == in the last line should be =.

    However, I would recommend changing your code to something like this:

    $valuemap = array(
       'asd' => 'Agreement Start Date',
       'f_name' => 'first name', 
        // and so on...
    );
    
    function apply_valuemap($input) {
        global $valuemap;
        return $valuemap[$input];
    }
    
    array_map('apply_valuemap', $changedvalue);
    

    This way, it’s way easier to add more values you want to replace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three array..say array1,array2,array3. All these arrays contains dictionary.Now, I want to copy
let's say i have 2 array. array1: value = 2 value = 1 value
I have this 2D array (say double[10][10]) which contain some 1.0 and 10.0, rest
I have an array lets say a = { 1,4,5,6,2,23,4,2}; now I have to
If I have an array of say, some ID's of users. How could i
I have the array variable say $value, and it has the below given array
What I want to do is following. Lets say we have array like that
I have a javascript array say jsArr[] . I want this array to be
I have an array lets say array1 = [abc, a, wxyz, ab,......] How do
I have an array say var list = [first, second]; now I assign list

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.