count

count

count

Php count fonskiyonu yine çok kullandığımız fonksiyonlardandır. Dizi içerisinde kaç eleman olduğunu bize söyler. Basit bir uygulama yaparak anlatırsak daha anlaşılır olacaktır. 

$degisken = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
	  
	
	$parcala = explode("o", $degisken);
	
	echo count($parcala);
	
	// çıktısı : 26 

ben bu içerikleri alt alta yazdımak istiyorum dersem ve kaç tane olmadığını bilmediğim için kolayca bulup yazdırabilirim. 

 
	$degisken = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
	  
	
	$parcala = explode("o", $degisken);
	
	$toplam =  count($parcala);
	
	// çıktısı : 26 
	
	
	for($x=0; $x< $toplam; $x++){
		
		echo $parcala[$x].'<br>';
	}
	 
	/*
	
	L
rem Ipsum is simply dummy text
f the printing and typesetting industry. L
rem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unkn
wn printer t

k a galley
f type and scrambled it t
make a type specimen b

k. It has survived n
t
nly five centuries, but als
the leap int
electr
nic typesetting, remaining essentially unchanged. It was p
pularised in the 1960s with the release
f Letraset sheets c
ntaining L
rem Ipsum passages, and m
re recently with deskt
p publishing s
ftware like Aldus PageMaker including versi
ns
f L
rem Ipsum.

	*/ 

Tepkiniz Nedir?

like
1
dislike
0
love
0
funny
0
angry
0
sad
0
wow
0