1

I have this code:

if( ( $cacheout - $data['import_time'] ) > 129600 ){
                unset( $fresh_data[$key] );
}

$data gets the time (import time) from an array which is a digital value, for example: 1576784091.

I wanted to add 43200 to this $data['import_time'] variable.

How to save it?

4
  • 1
    Show the part of $data array. And desired output. Commented Dec 19, 2019 at 21:52
  • Do you want to add $data['import_time'] + 43200 or swith import_time to 43200 ? Commented Dec 19, 2019 at 21:55
  • I want to add 43200, not switch Commented Dec 19, 2019 at 21:55
  • 2
    This is incredibly basic programming, are we missing something? You do it the same way you add to any other variable, there's nothing special about arrays. Commented Dec 19, 2019 at 22:42

2 Answers 2

2
$data['import_time'] += 43200;
Sign up to request clarification or add additional context in comments.

2 Comments

Wouldn't it be simpler to use +=?
Why not both versions?
0

Try the below code:

$data['import_time'] = $data['import_time'] + 43200;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.