Help with function on the video object


#1

I am told I need to change this code from a numeric_format method to a numeric_format function.on the video object, after doing some research I can’t figure out what is needed. Any suggestions will be appreciated.

'PRICE' => $video->number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],2),

#2

Who did this and why is he not doing it by himself? The main difference between a method and a function is that a method belongs to a class / an object and a function ist stand-alone.


#3

What I’m trying to do is to get this line:

'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],2)

to work with this array, but something is wrong:

  if (!empty($get_videos)) {
$len = count($get_videos);
foreach ($get_videos as $key => $video) {
    $video = PT_GetVideoByID($video, 0, 0, 0);
    $pt->last_video = false;
    if ($key == $len - 1) {
        $pt->last_video = true;
    }
    $final .= PT_LoadPage('search/list', array(
        'ID' => $video->id,
        'USER_DATA' => $video->owner,
        'THUMBNAIL' => $video->thumbnail,
        'URL' => $video->url,
        'TITLE' => $video->title,
        'DESC' => $video->markup_description,
        'VIEWS' => $video->views,
        'VIEWS_NUM' => number_format($video->views),
        'TIME' => $video->time_ago,
        'DURATION' => $video->duration,
        'PRICE' => $video_play_price_user,
        'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],2)

    ));
}
}

any guidance will be appreciated


#4

And what should this mean to anybody?


#5

In this code

'PRICE' => $video_play_price_user,
'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],2)

where does the first variable, $video_play_price_user come from? Shouldn’t this be something from your $video object rather than a flat variable? And if you already have the user-price for the video (making a presumption from the variable name) what is the reason for the next line of code, which seems to be calculating that very same price?