Search found 18 matches

by networkguy
Sat Apr 11, 2009 1:02 am
Forum: PHP - Code
Topic: add time to timestamp
Replies: 8
Views: 214

Re: add time to timestamp

The answer I figured out is simple. I'd increment the day or hours using date() to set the "expiry", convert it to int (using maketime() by first using impode on the output of date, storing it in a array, then passing the array elements to maketime()) value and then compare the current dat...
by networkguy
Thu Apr 09, 2009 12:37 pm
Forum: PHP - Code
Topic: add time to timestamp
Replies: 8
Views: 214

Re: add time to timestamp

Actually, forget it I figured it out.


Thanks anyways! :banghead:
by networkguy
Thu Apr 09, 2009 12:08 pm
Forum: PHP - Code
Topic: add time to timestamp
Replies: 8
Views: 214

Re: add time to timestamp

After searching a bit, I find mktime() function will do what I need.

How would I mktime() with the current time?

mktime(time()) ? The arguments for mktime() seem to only take int values. Do I pass in int values from the date() + time() function?
by networkguy
Thu Apr 09, 2009 10:58 am
Forum: PHP - Code
Topic: add time to timestamp
Replies: 8
Views: 214

add time to timestamp

I was wondering if anyone could help me with this: I have a timestamp in this format: date( "F, j, Y g:i:a"); for a given record. I would like to add 12 hours to that so that I could keep track of if a subroutine should execute or not. Each time the conditional statement approaches it shou...
by networkguy
Wed Apr 08, 2009 6:34 pm
Forum: PHP - Code
Topic: automatic edit
Replies: 0
Views: 109

automatic edit

Using oop php 5 approach, with two classes, one class: Book class and the other class: Page class.The Book class keeps an updated array of Page objects, as it is composed of them. If say I added a new Page (through the Book object) object properties to the database using save() method from the Page ...
by networkguy
Mon Apr 06, 2009 4:16 pm
Forum: PHP - Code
Topic: Edit object properties
Replies: 2
Views: 305

Re: Edit object properties

Excellent, thank you!

You confirmed a lot what I had in mind. Thank you very much for the reply again!
by networkguy
Mon Apr 06, 2009 6:08 am
Forum: PHP - Code
Topic: Edit object properties
Replies: 2
Views: 305

Edit object properties

Hi, I have a question about editing object properties and subsequent database values. If you create and save an objects properties into the database, how would you refer back to that object if in case you wanted to edit one or more of its properties. For example, lets say I instantiated a new Page()...
by networkguy
Mon Apr 06, 2009 12:06 am
Forum: PHP - Theory and Design
Topic: Edit object properties
Replies: 2
Views: 589

Edit object properties

pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too. Hi, I have a question about editing object properties and subsequen...
by networkguy
Tue Mar 31, 2009 3:54 pm
Forum: PHP - Theory and Design
Topic: Question: composition
Replies: 7
Views: 964

Re: Question: composition

Thank you, good explanation. I don't think I need to utilize polymorphism so I guess I'll just stick with what I have....
by networkguy
Tue Mar 31, 2009 10:47 am
Forum: PHP - Theory and Design
Topic: Question: composition
Replies: 7
Views: 964

Re: Question: composition

It's been ~1 hour since you first posted. This stuff isn't instant you know :roll: What happens with that code? If the goal is to output some strings, then it should work. Sorry if I sound a little crabby, my background is in c programming, i have switched to OOP now and have a headache everyday si...
by networkguy
Tue Mar 31, 2009 10:43 am
Forum: PHP - Theory and Design
Topic: Question: composition
Replies: 7
Views: 964

Re: Question: composition

It's been ~1 hour since you first posted. This stuff isn't instant you know :roll: What happens with that code? If the goal is to output some strings, then it should work. Yes exactly, just output some string... So am I doing composition properly since object will be composed of an array of string ...
by networkguy
Tue Mar 31, 2009 10:21 am
Forum: PHP - Theory and Design
Topic: Question: composition
Replies: 7
Views: 964

Re: Question: composition

I'm not totally sure what you're asking. Do you have a code example? What I'm asking for is what is meant by proper way to do composition in php. Why would this NOT work? //I have tried much more complex code (over 800 lines) and works perfectly using this method //I have tried with another (see ot...
by networkguy
Tue Mar 31, 2009 9:38 am
Forum: PHP - Theory and Design
Topic: Question: composition
Replies: 7
Views: 964

Question: composition

Hi, I am php OOP newbie, please help me out! What is wrong with instantiating a object through another object by calling the methods of the object returning some string value and storing it in a string of vector/array objects. Is it okay to call this "composition" ? I looked up many tutori...
by networkguy
Tue Mar 31, 2009 4:25 am
Forum: PHP - Code
Topic: Object of class opLog could not converted to string
Replies: 7
Views: 480

Re: Object of class opLog could not converted to string

arborint wrote:I assume that $obj is an object, so you need to call one of its methods that returns a string.

I'm sorry, I'm coming from background in c, this is like the few times I am using a foreach statement. I have changed it multiple times, probably from good to bad to worse (as you saw).
by networkguy
Tue Mar 31, 2009 4:21 am
Forum: PHP - Code
Topic: Object of class opLog could not converted to string
Replies: 7
Views: 480

Re: Object of class opLog could not converted to string

New error now when I changed foreach statement to : foreach($this->logs as $i) { //$this->logs is same thing as before except loose array instead of returned array echo $this->logs[$i]; error: Warning: Illegal offset type in... shows this warning 3 times, again indicating length of array has proper ...