<repo_name>x2449265627/elven<file_sep>/day4/two.php
<?php 

class people{
	public $name = '魏晓';
	private $sex;
	public function say(){
       echo $this->name;
	}
	public function love($sex){
	  $this->sex = $sex;
      if($this->sex == "男"){
      	echo "我要找女朋友";
      	die;
      }
      echo "我要找男朋友";

	}
}
$people = new people();
$people->say();
$people->love('男');

?><file_sep>/day2/index.php
<?php 
cLass math{
  public function calSteps($n){
  	//台阶数量为1 或者 2 时候 直接返回当前值

  	if($n == 1){
  	   return 1;
  	}
  	if($n == 2){
  		return 2;
  	}
     //台阶数量大于1跟 2 返回前两项的和
  	return $this->calSteps($n-1)+$this->calSteps($n-2);
  }	
}
//青蛙跳 其实是一个菲比那切数列 
$math = new math();
$res = $math->calSteps(5);
echo $res;
 ?><file_sep>/day4/index.php
<?php 

class Math{
	public function calFn($n,$m){
		if($m<$n){
			return false;
		}
		$count = 0;
		$n_len = strlen($n);
		$m_len = strlen($m);
		for($i=$n;$i<=$m;$i++){
			$len = strlen($i); 
			if($len == 1){
				if($i%pow(10, $len) == 1){
					$count++; 
					continue; 
				}		

			}
			for ($j=$len; $j >=1 ; $j--) { 
				if($j == 2){
					if($i/10 == 1){
						$count++;

					}
				}
				if($i%pow(10, $j) == 1){
					$count++; 
					continue; 
				}	
			}
        

		}
		     echo $count;
	}
}

		$math = new Math();
		$math->calFn(1,13);
?><file_sep>/day12/index.php
<?php 

class math{

	public function NumberOf1($n){
		$i=0;
		while ($n >=1) {
	
			if($n%2 == 1){
                $i++;
			}
			$n = floor($n/2);
		}
	      echo $i;
	}
}
$math = new math();
$res = $math->NumberOf1(4);
?><file_sep>/day10/index.php
<?php 
class math{
	public function Find($target, $array){
		$count_o = count($array);
		if($target < $array[0][0]){
			return false;
		}
		$count_t = count($array[$count_o-1]);
		if($target > $array[$count_o-1][$count_t-1]){	
			return false;
		}
		foreach ($array as $k => $v) {
			  foreach ($v as $key => $value) {
			  	  if($value == $target){
			  	  	return true;
			  	  }
			  }
		}
	}


}
$target =  7;
$array=[[1,2,8,9],[2,4,9,12],[4,7,10,13],[6,8,11,15]];
$math = new math();
$res = $math->Find($target, $array);
var_dump($res);
?><file_sep>/day6/index.php

<?php 

class math{
	public function FindNumsAppearOnce($array){
		$arr = [];
		$res = array_count_values($array);
        foreach ($res as $k => $v) {
        	if($v == 1){
        		$arr[] = $k;
        	}
        }
		// foreach ($array as $k => $v) {
		// 	if(in_array($v,$arr)){
		// 		unset($arr[$v]);
		// 		continue;
		// 	}
		// 	$arr[$v] = $v;
		// }
		return $arr;
	}
}

$math = new math();
$array = [2,4,3,6,3,2,5,5,5];
$res = $math->FindNumsAppearOnce($array);
var_dump($res);
 ?><file_sep>/day5/index.php
<?php

class Math{
	public static $num;
	public function GetUglyNumber_Solution($index){
       
         if($index == 1){
         	echo '是';
         	die;
         }
         if($index % 2 == 0){
         	$index = $index/2;
         	$this->GetUglyNumber_Solution($index);
         	die;
         }
         if($index % 3 == 0){
         	$index = $index/3;
         	$this->GetUglyNumber_Solution($index);
         	die;
         }
         if($index % 5 == 0){
         	$index = $index/5;
         	$this->GetUglyNumber_Solution($index);
         	die;
         }
         echo '不是';
	}
}

$math = new Math();
$res = $math->GetUglyNumber_Solution(7);
echo $res;
?>
<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

</body>
</html>
<script type="text/javascript"></script><file_sep>/day3/index.php
<?php 	

class Math{
	public function getstr($arr = []){
		$arrlen = count($arr);
		for($i=0;$i<$arrlen;$i++){
			if($arr[$i]%2 == 0){
				$arr1[] = $arr[$i];
			}else{
				$arr2[] = $arr[$i];
			}
			
			
		}
		$arr3 =array_merge($arr2,$arr1);
		var_dump($arr3);
	}
}
$arr = [1,2,3,4,5,6];
$math = new Math();
$res =  $math->getstr($arr);
?><file_sep>/day1/index.php
<?php



class Math{
	public function countstr($str=''){
		if($str == ''){
			return false;
			die;
		}
		$strtoarr =  str_split($str);
  	 // var_dump($strtoarr);
		foreach ($strtoarr as $key => $value) {
			if(isset($arr[$value])){
				$arr[$value]++;
			}else{
				$arr[$value] = 1;
			}
			if($arr[$value] >=		 3 ){
				return $value;
			}
			
		}
	}
}
$str = 'Have you ever gone shopping and';
$math = new Math();
$res = $math->countstr($str);
echo $res;

?><file_sep>/day11/index.php
<?php 

class math{
	public function Combine($arr_A, $arr_B) {
		$newArr =[];

		$i =0;
		$j = 0;
		$count_a = count($arr_A);

		$count_b = count($arr_B);
		$count_c = ($count_a + $count_b) -1;
		for($k=0;$k<=$count_c;$k++){
			if($arr_A[$i] <= $arr_B[$j]){
				echo $i;
				if($i >= $count_a - 1){
					echo $j;
					$newArr[$k] = $arr_B[$j];
					$j++;

					break;
				}
				$newArr[$k] = $arr_A[$i];
				
					$i++;

		

			}else{
				echo $j;

				$newArr[$k] = $arr_B[$j];
				$j++;
			}
		}
		echo "<pre>";
		var_dump($newArr);
	}

}

$math =  new math();
$arr_A=[1,3,6,9];
$arr_B=[2,4,5,8,20];
$res = $math->Combine($arr_A, $arr_B);

?><file_sep>/day8/index.php
<?php 
class Math{
	public static $sum;
	public function Sum_Solution($n){
        self::$sum += $n;
		$n &&  $n + $this->Sum_Solution($n-1);
	}


}
$math = new Math();
$math->Sum_Solution(5);
echo $math::$sum;

?><file_sep>/day9/index.php
<?php 
$i = 0;
$j =1;
$x = $i++ + $j++;
echo $x;
?><file_sep>/day7/index.php

<?php 	

class Db{
	private static $db;
	private $yy = '22';
	private function __construct(){
        new PDO("mysql:dbname=dianshang;host=127.0.0.1",'root','root');

	}



	public static function getDb(){
		$res = $this->yy;
		var_dump($res);
        if (!(self::$db instanceof Db)) {
        	// echo 1;die;
            self::$db = new Db();
        }
       
        return self::$db;
	}





	private function __clone(){

	}

}

 
$res = Db::getDB();
var_dump($res);
?>