fork(1) download
  1. <?php
  2. $posts = array(
  3. $array[0] = array(
  4. "title" => "A",
  5. "url" => "http://c...content-available-to-author-only...m.com/a"
  6. ),
  7. $array[1] = array(
  8. "title" => "G",
  9. "url" => "http://c...content-available-to-author-only...m.com/g"
  10. ),
  11. $array[2] = array(
  12. "title" => "C",
  13. "url" => "http://c...content-available-to-author-only...m.com/c"
  14. ),
  15. $array[3] = array(
  16. "title" => "B",
  17. "url" => "http://c...content-available-to-author-only...m.com/b"
  18. ),
  19. $array[4] = array(
  20. "title" => "J",
  21. "url" => "http://c...content-available-to-author-only...m.com/j"
  22. ),
  23. );
  24.  
  25. ksort($posts);
  26. sort($posts);
  27.  
  28. $actual_title = "C";
  29. $actual_link = "http://com.сom/c";
  30.  
  31. foreach($posts as $post) {
  32. echo $post['title']."<br>\n";
  33. }
  34.  
  35. echo "\n<pre>";
  36. print_r($posts);
  37. echo "</pre>";
  38.  
  39. /*
  40. Хочу получить это, если $actual_title = "C";
  41. G<br>
  42. J<br>
  43. A<br>
  44. B<br>
  45.  
  46. */
  47. ?>
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
A<br>
B<br>
C<br>
G<br>
J<br>

<pre>Array
(
    [0] => Array
        (
            [title] => A
            [url] => http://c...content-available-to-author-only...m.com/a
        )

    [1] => Array
        (
            [title] => B
            [url] => http://c...content-available-to-author-only...m.com/b
        )

    [2] => Array
        (
            [title] => C
            [url] => http://c...content-available-to-author-only...m.com/c
        )

    [3] => Array
        (
            [title] => G
            [url] => http://c...content-available-to-author-only...m.com/g
        )

    [4] => Array
        (
            [title] => J
            [url] => http://c...content-available-to-author-only...m.com/j
        )

)
</pre>