User Profile

Collapse

Profile Sidebar

Collapse
deizi23
deizi23
Last Activity: Nov 30 '15, 09:04 AM
Joined: Nov 16 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • deizi23
    started a topic How to bubble sort 2d array?
    in PHP

    How to bubble sort 2d array?

    I have to sort 2d array
    $
    Code:
    items = array(
    		 array(15, 16, 8, 1),
    		 array(2, 3, 4, 7),
    		 array(9, 11, 19, 6,)
    );
     with bubble sort ant to get something like this
    
    1,2,3,4
    6,7,8,9
    11,15,16,19
    I can't find anywhere bubble sort for multiple arrays.
    Can you help me?
    See more | Go to post
    Last edited by zmbd; Nov 29 '15, 03:57 PM. Reason: [z{please use the [CODE/] formatting tool for scripts}]

  • deizi23
    started a topic how to get negative numbers from string?
    in PHP

    how to get negative numbers from string?

    Code:
    $str = 'asd-12sdf45-56asdf100';
    function get_numerics ($str) {
            preg_match_all('/\d+/', $str, $matches);
            print_r( $matches);
        }
        get_numerics($str);
    But I don't know how to get negative numbers "-12", "-56"
    See more | Go to post

  • deizi23
    started a topic How to walk trough 2d array in ONE loop?
    in PHP

    How to walk trough 2d array in ONE loop?

    I have to print all values with one loop (IT DOESN'T NEED print_r[$array])
    this is what i made til now but it isn't working properly
    Code:
    $array = array(
    		array(11,12,13,14,15,16),
    		array(21,22,23,24,25,26),
    		array(31,32,33,34,35,36),
    		array(41,42,43,44,45,46),
    		array(51,52,53,54,55,56),
    		array(61,62,63,64,65,66)
    );
    
    
    $colindex = 0;
    $rowindex = 0;
    ...
    See more | Go to post

  • deizi23
    started a topic How to print a row from 2d array?
    in PHP

    How to print a row from 2d array?

    i want to print 1,3,5 rows from 2d array. Can i use some kind of implode or loop?

    $array = array(
    array(11,12,13, 14,15,16),
    array(21,22,23, 24,25,26),
    array(31,32,33, 34,35,36),
    array(41,42,43, 44,45,46),
    array(51,52,53, 54,55,56),
    array(61,62,63, 64,65,66)
    );

    I want it to look like this: "array row1: 11,12,13,14,15, 16"
    See more | Go to post
    Last edited by deizi23; Nov 18 '15, 11:16 AM. Reason: forgot to add some line

  • deizi23
    started a topic max sum of row and max sum of column 2d array
    in PHP

    max sum of row and max sum of column 2d array

    Please help me to find the biggest sum of row and the biggest sum of column

    Example:
    array:
    1,2,3,4
    5,6,7,8
    9,10,11,12
    13,14,15,16

    max sum by row: 58;
    max sum by column: 40;
    See more | Go to post

  • deizi23
    started a topic Find minimum and maximum value with loop
    in PHP

    Find minimum and maximum value with loop

    Code:
    array = array(
    		array(48,72,13,14,15),
    		array(21,22,53,24,75),
    		array(31,57,33,34,35),
    		array(41,95,43,44,45),
    		array(59,52,53,54,55),
    		array(61,69,63,64,65)
    		
    );
    
    $high = 0;// highest value
    $low = 100;// lowest value
    for ($row = 0; $row < count($array); $row++)
    { //find highest value
    	for ($col = 0; $col < count($array); $col++)
    	{
    		if ($array[$row][$col]
    ...
    See more | Go to post
    Last edited by Rabbit; Nov 16 '15, 05:18 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
No activity results to display
Show More
Working...