usort fonksiyonu

Kendi sort fonksiyonumu php ile nasıl yazarım?

<?php
$inputwords 
= array("whichever","word","is","the","longest","will","appear","at","the","top"); usort($inputwords"sortlen");

print_r($inputwords);

function 
sortlen($a,$b) {

$lena strlen($a);
$lenb strlen($b);
if (
$lena == $lenb) return 0;
return (
$lena $lenb) ? -1; }  

?>

Array ( [0] => whichever [1] => longest [2] => appear [3] => word [4] => will [5] => top [6] => the [7] => the [8] => at [9] => is )  

unset fonksiyonu

Belli bir dizi değerini diziden nasıl silerim?

<?php
$letters 
range("A","Z");
unset(
$letters[2]); 

print_r($letters);  
?>


Array ( [0] => A [1] => B [3] => D [4] => E [5] => F [6] => G [7] => H [8] => I [9] => J [10] => K [11] => L [12] => M [13] => N [14] => O [15] => P [16] => Q [17] => R [18] => S [19] => T [20] => U [21] => V [22] => W [23] => X [24] => Y [25] => Z )

ucwords fonksiyonu

Php'de her kelimenin ilk harfini büyük harfle nasıl yazarım?

<?php
$mystring 
"php ucwords fonksiyonu ile her kelimenin ilk harfini büyük yazdım";
echo 
ucwords($mystring);  

?>

Php Ucwords Fonksiyonu İle Her Kelimenin İlk Harfini Büyük Yazdım  

ucfirst fonksiyonu

Php ile bir cümlenin ilk harfini nasıl büyük harfle yazarım?

<?php
$expected 
"ucfirst fonksiyonu ile cümlenin baş harfi büyük yazılır.";
echo 
ucfirst(trim($expected));

?>

Ucfirst fonksiyonu ile cümlenin baş harfi büyük yazılır. 

substr_count fonksiyonu

Php kodunda ne kadar satır var?

<?php
$sentence 
"This is a sentence that has lots 
of

line breaks

in it

for no apparent 

reason!!!"
;
$numberoflinebreaks substr_count($sentence,"\n");
echo 
"There are $numberoflinebreaks line breaks in that sentence" 

?>

There are 9 line breaks in that sentence  

str_replace fonksiyonu

Php ile cümle içinde geçen uygunsuz içerikli (küfürlü) kelimeleri nasıl sansürleyebilirim?

<?php $usersays "I hate this bloody film it's useless!"; $cleaned str_replace("bloody","b****y",$usersays);
echo 
"You wrote: $cleaned";  

?>

You wrote: I hate this b****y film it's useless!  

str_repeat fonksiyonu

Php'de istenen string ifadeyi birden çok nasıl yazabilirim?

<?php
$bemine 
"I love you lots ";
echo 
"$bemine" str_repeat("and LOTS ",10);  

?>

I love you lots and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS

strtoupper fonksiyonu

Php'de tüm harfleri nasıl büyük harfe çevirebilirim?

<?php
$mystring 
"can anybody hear me?";
echo 
strtoupper($mystring);  

?>

CAN ANYBODY HEAR ME?  

strtolower fonksiyonu

Php'de bir cümlenin tüm harflerini küçük harfe nasıl çevirebilirim?

<?php
$mystring 
"I DON'T LIKE SHOUTING!";
echo 
strtolower($mystring);  

?>

i don't like shouting!  

strrpos fonksiyonu

Php'de cümle içinde aranan karakterin en son kaçıncı karakterde yer aldığını nasıl bulabilirim?

<?php
$data 
"lets go backwards";

$lastr strrpos($data,"r");
echo 
"The last 'r' occurs at $lastr";

?>

The last 'r' occurs at 14