Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
<?php # variable echo " QUESTIONNAIRE :"; $giusha = "giusha"; $asaki = 24; $wona = 68.2; $simagle = 1.8; echo "\nMy name $giusha 🙋️"; echo "\nMy age" ."$asaki 🔥"; echo "\nMy weight $wona 🏋️ "; print "\nMy height $simagle 🧍"; print "\n\n MY LOVING BREND :"; # array $brends = [ "Name"=>"BMW", "Name1"=>"MERCEDEC", "Name2"=> "toyota", ]; $brends ["no person"] = [true]; print_r ($brends); echo 'My lovd is :'. $brends ['Name1'] ."\n"; echo "\n When you born?"; $born = 1998; echo "\n\ni was born $born : 3 june"; ?>
by giorgi modebadze
3 years ago
0
PHP
#array
#array types
#string
0
Indexed array ptint_r var_dump
<?php

$colors = ["Red", 7735, "Blue"];
$colors[] = "Yellow";  //add new member in last position


echo $colors[0]; 

echo "\n\n\n";

print_r($colors);

echo "\n\n\n";

var_dump($colors);
OUTPUT:
Red


Array
(
    [0] => Red
    [1] => 7735
    [2] => Blue
    [3] => Yellow
)



array(4) {
  [0]=>
  string(3) "Red"
  [1]=>
  int(7735)
  [2]=>
  string(4) "Blue"
  [3]=>
  string(6) "Yellow"
}
by otar datuadze
3 years ago
0
PHP
0
by nikoloz nachkebia
3 years ago
0
PHP
Finds the Max of two numbers
0
by nikoloz nachkebia
3 years ago
0
PHP
Find the Max of three numbers
0
by nikoloz nachkebia
3 years ago
0
PHP
Swapping two numbers
0
by nikoloz nachkebia
3 years ago
0
PHP
Calculates count
sum
product
avg
min and max
0
// Given an array nums of size n, return the majority element. // The majority element is the element that appears more than ⌊n / 2⌋ times. // Example 1: Input: nums = [3,2,3], Output: 3
function majorityElement($nums) {
    $quantity = count($nums);
    $nums = array_count_values($nums);
    foreach($nums as $key => $num) {
        // two values can't be more than 50% of array
	if ($num > $quantity / 2) {
	    return $key;
	}
    }
}
echo majorityElement([0, 1, 1, 3, 4, 1, 1]);   //1
echo majorityElement([2, 2 ,1 ,1 ,1 ,2 ,2]);   //2
by Luka Khitaridze
3 years ago
0
PHP
Array
0
// Given a sorted array of distinct integers and a target value, return the index if the target is found. // If not, return the index where it would be if it were inserted in order.
function searchInsert($nums, $target) {
    if (in_array($target, $nums)) {
        $index = array_search($target, $nums);
	return $index;
    }
    if (!in_array($target, $nums)) {
        array_push($nums, $target);
	sort($nums);
	$index2 = array_search($target, $nums);
	return $index2;
    }
}
echo searchInsert([1, 3, 5, 6], 5);  // 2
echo searchInsert([1, 3, 5, 6], 2);  // 1
by Luka Khitaridze
3 years ago
0
PHP
Array
0
by nikoloz nachkebia
3 years ago
0
PHP
Sum of numbers from 1 to n
0
// Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
function containsDuplicate($nums) {
    $nums = array_count_values($nums);
    foreach ($nums as $key => $num) {
	if ($num >= 2) {
	    return true;
	}
    }
    return false;
}
echo containsDuplicate([1, 2, 3, 1]);
by Luka Khitaridze
3 years ago
0
PHP
Array
0
Results: 1578