Bu kodları 3-5 yerden bulup birleştirdim işinize yarayacağını düşünüyorum.
---------------------------------------------------------------------
<?php
$mystring = "php ucwords fonksiyonu ile her kelimenin ilk harfini büyük yazdım";
echo ucwords($mystring);
?>
------------------------------------------------------------------------
<?php
$expected = "ucfirst fonksiyonu ile cümlenin baş harfi büyük yazılır.";
echo ucfirst(trim($expected));
?>
-------------------------------------------------------------------------
SATIR SAYACI
<?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";
?>
------------------------------------------------------------------------
KÜFÜR SANSÜRÜ
<?php $usersays = "I hate this bloody film it's useless!"; $cleaned = str_replace("bloody","b****y",$usersays);
echo "You wrote: $cleaned";
?>
-------------------------------------------------------------------------
UZUNLUK SAYACI
<?php
$data = "hello world";
echo strlen($data); //11
?>
-------------------------------------------------------------------------
TARİH
<?php
$date = getdate();
echo $date['month'];
?>
-------------------------------------------------------------------------
RASTEGELE
<?php
$lottery = range(1,49);
$onenumber = array_rand($lottery);
echo "One number is: ".$onenumber;
?>
<?php foreach(array_rand(range(1,49),6) as $number) echo "$number ";
?>
-------------------------------------------------------------------------
İLK CÜMLEYİ ALMA (BÖLME)
$metin = 'Bu birinci cümle. Bu ise ikinci cümle';
$cumle = explode('.', $metin);
echo $cumle[0];
-------------------------------------------------------------------------
echo 'Bu yazıdan sonra kodlar duracak';
exit;
echo 'Kodlar durduğu için bu yazı yazılmayacak.';
------------------------------------------------------------------------
Yararlı PHP Fonksiyonları
1
●460
- 07-05-2013, 23:07:14Üyeliği durduruldu