Sabtu, 19 Oktober 2013

PHP Indonesia - Facebook: a.txt: ---------------------------- 1 I am big 2 I...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
a.txt: ---------------------------- 1 I am big 2 I...
Oct 19th 2013, 07:03, by Bayang Hitam

Bayang Hitam 7:03am Oct 19
a.txt:
----------------------------
1 I am big
2 I am small
3 I am biggest
---------------------------

gimana yah mau check jika "big" wujud pada line 3?? iaitu "I am biggest" dan print line tsbut?

output:
---------------------
"big" exists in " I am biggest"
---------------------

Gunawan Mujur Wibisono 7:07am Oct 19
pertama kita pecah2 isi a.txt dalam array.. pake explode
lalu check masing2 array
kl ketemu tampilkan tulisan kyk di atas

Bayang Hitam 7:08am Oct 19
jadi, gimana mau select last line? iaitu line 3?

Gunawan Mujur Wibisono 7:08am Oct 19
coba perhatikan penggunaan foreach...

OQ 7:28am Oct 19
nga ada basa basi nya gan say hi gtu,

coba pake preg_replace

<?php
$string = '1 I am big
2 I am small
3 I am biggest';
$patterns = array();
$patterns[0] = '/1 I am big/';
$patterns[1] = '/2 I am small/';
$patterns[2] = '/3 I am biggest/';
$replacements = array();
$replacements[2] = '"big" exists in " I am biggest"';
$replacements[1] = '';
$replacements[0] = '';
echo preg_replace($patterns, $replacements, $string);
?>

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar