Jump to content

Homer5

New Members
  • Posts

    4
  • Joined

  • Last visited

Homer5's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. this is my solution: $x = ['a' => 2, 'b' => 1, 'c' => 4, 'd' => 1]; $x1 = array_keys($x); $x2 = array_values($x); $z = []; for ($i=0; $i<count($x); $i++) { array_push($z, [$x1[$i],$x2[$i]] ); } print_r($z); //[['a', 2], ['b', 1], ['c', 4], ['d', 1]]; is there easier (more elegant) way to do the same ?
  2. @Psycho - you forgot $output = ""; before final foreach loop, but other than that your code works like a charm ! Thanks a lot !
  3. I've managed to upload .csv file, process it, and display output ... but I'm puzzled how to make it look nice so it can be exported (save as txt) It's indexed array of associative arrays, so I am doing output like this: for ($i=0; $i<=count($filtered_array)-1; $i++) { echo $filtered_array[$i]['position'] . ") " . $filtered_array[$i]['Title'] . " ---> " . $filtered_array[$i]['URL'] . "<br />"; } output I get is: 1) Sanctum ---> http://www.imdb.com/title/tt0881320/ 2) Horrible Bosses ---> http://www.imdb.com/title/tt1499658/ 3) Pirates of the Caribbean: On Stranger Tides ---> http://www.imdb.com/title/tt1298650/ 4) Mission: Impossible - Ghost Protocol ---> http://www.imdb.com/title/tt1229238/ 5) Headhunters ---> http://www.imdb.com/title/tt1614989/ Output I'd like looks something like this: 1) Sanctum ---> http://www.imdb.com/title/tt0881320/ 2) Horrible Bosses ---> http://www.imdb.com/title/tt1499658/ 3) Pirates of the Caribbean: On Stranger Tides ---> http://www.imdb.com/title/tt1298650/ 4) Mission: Impossible - Ghost Protocol ---> http://www.imdb.com/title/tt1229238/ 5) Headhunters ---> http://www.imdb.com/title/tt1614989/ How would you do it ? Could it be done easier with help of some HTML ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.