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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:27:10+00:00 2026-05-13T05:27:10+00:00

I have an array of Shift objects that I’m working with in PHP. I

  • 0

I have an array of Shift objects that I’m working with in PHP. I need to store these objects within a database. I’m working on a function that will add shifts to the database:

$Serialized_S = get_option('MasterShiftString');
$MasterShiftArray = unserialize($Serialized_S);

if(!$MasterShiftArray)
{
    echo "MasterShiftArray returns false";
}//end if

echo "Serialized_S:";
print_r($Serialized_S); 
echo "<br />MasterShiftString:";
print_r($MasterShiftString); 
echo "<br />end<br />"; 



if(!is_array($MasterShiftArray))
{
    echo "MasterShiftArray is not an Array....";
    $MasterShiftArray = array($last_monday_from_date => "");

}//end if
else
{


}//end else 

$WeekShiftArray = $MasterShiftArray;

array_push($WeekShiftArray, $CurrentShift);         

$MasterShiftArray[$last_monday_from_date] = $WeekShiftArray;

$Serialized_s = serialize($MasterShiftArray);

update_option('MasterShiftArray', $Serialized_s);

Of course what I’m getting when I execute this is:

last_monday_from_date: 1260777600
MasterShiftArray returns falseSerialized_S:admin,resource,2,1;admin,resource,2,1;admin,resource,2,1;admin,resource,2,1;
MasterShiftString:
end

What am I doing wrong here? I’ve tried the base64 encoding, but that doesn’t do anything to help.
MasterShiftArray is not an Array….

  • 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-13T05:27:11+00:00Added an answer on May 13, 2026 at 5:27 am

    This:

    admin,resource,2,1;admin,resource,2,1;admin,resource,2,1;admin,resource,2,1
    

    looks nothing at all like a PHP serialized array, that’s your problem. Garbage in = garbage out.

    Assuming that’s the data format you need to deal with, look into using explode to break it into an array on ‘;’, then explode each member of that array on ‘,’.

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

Sidebar

Related Questions

I have an array of shorts (short[]) that I need to write out to
I have an array of numbers that potentially have up to 8 decimal places
I have an array of items that are time sensitive. After an amount of
Imagine I have the following situation: File1.php <?php include(Function.php); log(test); ?> Function.php <?php function
I have a Moose class that i would like to store using Apache::Session::File. However,
I need to be able to store objects in javascript, and access them very
I am currently working on rails3 application that uses jQuery. I have a javascript
I have a System.Collections.BitArray array (~3000 items) and I would like to shift all
I have an array in Perl: my @my_array = (one,two,three,two,three); How do I remove
I have an array of a few million numbers. double* const data = new

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.