Search Results

Search found 3 results on 1 pages for 'pgfonline'.

Page 1/1 | 1 

  • usort - more parameters

    - by pgfonline
    Hallo, how can I pass more parameters to usort? I have different functions, which are very similar in structure, I want to have just one function: <?php $arr = array( array('number' => 100, 'string'=>'aaa'), array('number'=>50, 'string'=>'bdef'), array('number'=>150, 'string'=>'cbba') ); usort($arr, 'sortNumberDesc'); //How can I use just a single function? //How can I pass further parameters to usort? function sortNumberDesc($a, $b){ $a = $a['number']; $b = $b['number']; if ($a == $b) return 0; return ($a > $b) ? -1 : +1; } function sortNumberAsc($a, $b){ $a = $a['number']; $b = $b['number']; if ($a == $b) return 0; return ($a < $b) ? -1 : +1; } //I want to do the same with just one function: //Sort ID is the search index, reverse DESC or ASC function sort($a, $b, $sortId='number', $reverse = 0){ $a = $a[$sortId]; $b = $b[$sortId]; if ($a == $b) return 0; if($reverse == false) return ($a > $b) ? -1 : +1; else return ($a < $b) ? -1 : +1; } print_r($arr); ?>

    Read the article

  • HTML in Database

    - by pgfonline
    I am trying to read a html file which is a plain page with nothing but and tags in it. I'm using a function to return what is between each tag . . I can echo this to the page fine, but when I try to insert into the database the information is scattered. Any recommendations?

    Read the article

1