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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:19:31+00:00 2026-05-28T19:19:31+00:00

i have a var that holds an array of objects. $object : Array (

  • 0

i have a var that holds an array of objects. $object:

Array
(
[0] => First_Model Object
    (
        [_id:protected] => 988198
        [_status:protected] => some string here
        [_user_id:protected] => 18289
    )

[1] => Second_Model Object
    (
        [_id:protected] => 566198
        [_status:protected] => some string here
        [_user_id:protected] => 18290
    )
....

if i do:

<?php foreach($object as $row): ?>
<?php echo $row->status(); ?>
<?php endforeach: ?>

i get: some string here

what i want to do is to edit $row->status(), maybe use ucwords or something on this string and them place it back in the $object so that when i do the loop i get the changed result.

i could alter the result inside the foreach loop but i want my code to be clean.

so i need to grab $object->status do something with it then place it back on the $object then ill have the modified result..

any ideas on how to place the modified string inside the array of objects?

thanks

  • 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-28T19:19:32+00:00Added an answer on May 28, 2026 at 7:19 pm

    You need array_walk, all necessary examples are in documentation 🙂

    I would also create interface, that would declare methods: setStatus and getStatus and use

    if( !($item1 instanceof YourInterface)){
        throw new Exception(...);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that holds alerts and some information about them: var alerts
I have a ObservableCollection<Object> that holds two different types of objects: Directory and File
I have a class that holds some constants and will receive an object literal
When trying to stringify an object that holds an array of objects, I'm getting
I have a big multidimensional array that holds references to objects and I need
I have some code that sets the lang var to the site default language.
I have an external JavaScript that contains: function random_imglink(){ var myimages=new Array() myimages[1]="http://sevir.sitegoz.com/jchs/Banner1.png" myimages[2]="http://sevir.sitegoz.com/jchs/banner2.png"
i have an index.html file that holds: document.addEventListener(deviceready,onDeviceReady,false); function onDeviceReady(){ var deviceuid = device.uuid;
I have this command (visibleSelect is jquery variable that holds multiple select list): var
I have an object that holds an object that is definded as IEnumerable, i.e.

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.