php - Dizinin elemanları saymak

0 Cevap php

Ben ne kadar başarılı ve başarısız sonunda bilmek istiyorum. Ben dizi işlevini kullanmak istedi ama ben buradan devam etmek nasıl bilmiyorum:

public function array_internal($the_string)
$pass=  Array();
$failed = Array();
  if(strstr($the_string,"Success"))
    {
        $pass[] = +1;
    }
  else
    {
        $failed[] = +1;
    }

count($pass);

Bu adım, bu gibi her assert fonksiyonu çalışıyor:

 try {
      $this->assertEquals("off", $this->getValue("page"));
      throw new PHPUnit_Framework_AssertionFailedError("Success");
    } catch (PHPUnit_Framework_AssertionFailedError $e) {
      $this->array_internal($e->toString());
    }

Fonksiyonu kendisi Tamam. Benim sorunum sadece sayaç ile.

Teşekkür ederiz!

Edit I tried to do something like this:

$pass= 0;
$failed = 0;
public function array_internal($the_string)

  if(strstr($the_string,"Success"))
    {
        $pass += 1;
    }
  else
    {
        $failed += 1;
    }

$pass;

0 Cevap