Fordnox

Life is about trust

Subscribe to Fordnox
Technorati
del.icio.us
July-10-09

Zend PHP5 Certification – Pass

posted by Andrius

For a long time I have been considering whether it worth passing Zend PHP5 exam or not. Does it make any difference ? Well hell yes, it does. I am not saying this is very hard exam if you are working with PHP on daily basis, but having this little note about yourself makes big influence to your mind. It shows your true commitment to what you do.

A few words about exam. For me it looked very similar to Mock exams, which I have bought with exam voucher. It was not necessary but I think that helped me. After reading Zend PHP 5 Certification Study Guide, I have taken 4 mock exams with a grade “Excellent” and considered that was enough for me. Next I went to Pearson VUE and passed real exam in about 45min. To my mind 90 minutes it is more than enough. There was some tricky questions, but I am sure you will handle it with no problem.

Now I am looking forward of passing Zend Framework Certification. It is a shame that ZF is 1.8.4 version as I am writing this post, and exam is based on v1.5. But non the less I will take it and write about that experiance.

Zend PHP5 Certificate Logo
Read the rest of this entry »

August-1-08

Numbers to Words

posted by Andrius

The best solution for this problem is Pear package, but if you don’t like it, you can use this PHP class for converting to Lithuanian language:

Gal = "";
		$c = $this->Tukst($a, "", "", "");
		$skaicius = intval($skaicius / 1000);
		$a = $skaicius;
		If ($a % 1000 > 0) {
			$c = $this->Tukst($a, "čių", "tis", "čiai") . " tūkstan" . $this->Gal . " " . $c;
		}
		$skaicius = intval($skaicius / 1000);
		$a = $skaicius;
		If ($a % 1000 > 0) {
			$c = $this->Tukst($a, "ų", "as", "ai") . " milijon" . $this->Gal . " " . $c;
		}
		If ($formatas == 0) {
			If ($sk > 0) {
				$c = trim($c) . " Lt ";
			}
			Else {
				$c = "nulis Lt ";
			}
			$tmp = $this->Str((1 + $sk));
			//echo "$tmp
\n";
			$tmp = $tmp*100;
			//echo "$tmp
\n";
			////$tmp = $tmp%10000;
			//echo "$tmp
\n";
			$tmp = trim($tmp);
			//echo "$tmp
\n";
			//$tmp = mid($tmp, 1, 2);
			$tmp = substr($tmp, -2);
			//echo "$tmp
\n";

			//$c = $c . mid(trim(Str((1 + $sk) * 100 % 1000)), 1, 2) . " ct";
			$c = $c . $tmp . " ct";
		}
		If ($formatas == 1) {
			If (Intval($sk) == 0) {
				$c = "nulis";
			}
			$c = $c . " vienet" . $this->GG(Intval($sk));
		}
		$c = $this->UPPER_LT($this->Mid($c, 0, 1)) . $this->Mid($c, 1, 254);
		return $c;
	}

	private Function Tukst($A , $G1, $G2, $G3)
	{
		$C = "";
		$this->Gal = "";
		If ($A == 0) {
			//return $C;
		}
		$B = $A % 10;
		If ($B == 0) {
			$this->Gal = $G1;
		}
		If ($B == 1) {
			$this->Gal = $G2;
		}
		If ($B > 1) {
			$this->Gal = $G3;
		}
		switch ($B) {
			Case 1:
				$C = "vienas";
				break;
				Case 2:
					$C = "du";
					break;
					Case 3:
						$C = "trys";
						break;
						Case 4:
							$C = "keturi";
							break;
							Case 5:
								$C = "penki";
								break;
								Case 6:
									$C = "šeši";
									break;
									Case 7:
										$C = "septyni";
										break;
										Case 8:
											$C = "aštuoni";
											break;
											Case 9:
												$C = "devyni";
												break;
		}
		$B1 = $B;
		$A = Intval($A / 10);
		$B = $A % 10;
		If ($B == 1) {
			$this->Gal = $G1;
			switch ($B1) {
				Case 0:
					$C = "dešimt";
					break;
					Case 1:
						$C = "vienuolika";
						break;
						Case 2:
							$C = "dvylika";
							break;
							Case 3:
								$C = "trylika";
								break;
								Case 4:
									$C = "keturiolika";
									break;
									Case 5:
										$C = "penkiolika";
										break;
										Case 6:
											$C = "šešiolika";
											break;
											Case 7:
												$C = "septyniolika";
												break;
												Case 8:
													$C = "aštuoniolika";
													break;
													Case 9:
														$C = "devyniolika";
														break;
			}
		}
		switch ($B) {
			Case 2:
				$C = "dvidešimt " . $C;
				break;
				Case 3:
					$C = "trisdešimt " . $C;
					break;
					Case 4:
						$C = "keturiasdešimt " . $C;
						break;
						Case 5:
							$C = "penkiasdešimt " . $C;
							break;
							Case 6:
								$C = "šešiasdešimt " . $C;
								break;
								Case 7:
									$C = "septyniasdešimt " . $C;
									break;
									Case 8:
										$C = "aštuoniasdešimt " . $C;
										break;
										Case 9:
											$C = "devyniasdešimt " . $C;
											break;
		}

		$A = Intval($A / 10);
		$B = $A % 10;
		switch ($B) {
			Case 1:
				$C = "vienas šimtas " . $C;
				break;
				Case 2:
					$C = "du šimtai " . $C;
					break;
					Case 3:
						$C = "trys šimtai " . $C;
						break;
						Case 4:
							$C = "keturi šimtai " . $C;
							break;
							Case 5:
								$C = "penki šimtai " . $C;
								break;
								Case 6:
									$C = "šeši šimtai " . $C;
									break;
									Case 7:
										$C = "septyni šimtai " . $C;
										break;
										Case 8:
											$C = "aštuoni šimtai " . $C;
											break;
											Case 9:
												$C = "devyni šimtai " . $C;
												break;
		}
		return $C;
	}

	private function GG($X)
	{
		If (Intval($X / 10) % 10 != 1) {
			switch ($X % 10)
			{
				Case 0:
					return "ų";
					break;
					Case 1:
						return "as";
						break;
					default:
						return "ai";
			}
		}
		Else {
			return "ų";
		}
		return "";
	}

	private function UPPER_LT($s)
	{
		return strtoupper($s);
	}

	private function Mid($s, $from, $len) {
		return substr($s, $from, $len);
	}

	private function Str($i)
	{
		return $i;
	}
}
?>