www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] Php oop

  1. #1
    Join Date
    Jul 2005
    Location
    faisalabad, punjab, pakistan
    Posts
    241

    resolved [RESOLVED] Php oop

    HI, is there any way to add unlimited object to attach method of this string?

    like if query return 20 rows, i want to attach 20 attachments with this Object reference, is there any way to do so?


    PHP Code:
    $calendar->standard('today')->standard('prev-next')
            ->
    attach($events[1])
            ->
    attach($events[2])
            ->
    attach($events[3])
            ->
    attach($events[4]); 

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,176
    Without knowing what the attach() method really does, I can't be sure, but I'm guessing this might work. (I'm assuming that attach() is simply returning a reference to the $calendar object itself. If it's returning some other object, then it won't work).
    PHP Code:
    for($x=1$x<=20$x++) {
      
    $calendar->standard('today')->standard('prev-next')->attach($events[$x]);

    Or, assuming you want to attach each of the elements in $events, just:
    PHP Code:
    foreach($events as $evt) {
      
    $calendar->standard('today')->standard('prev-next')->attach($evt);

    Last edited by NogDog; 09-18-2012 at 09:33 AM.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jul 2005
    Location
    faisalabad, punjab, pakistan
    Posts
    241
    it works, thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles