Magic of programing
January 31st, 2010
Today I’ve been accidentally paying attention to a php code that reminds me a issue that it ain’t totally important how long has somebody been in programing world , just his ability to reduction and maintenance !
As indicated in my old publishing to seclude the usernames from passwd file , you would see the code I’ve inaccurately been satisfied with , so why and what’s the point ?
See this piece of php code :
1 2 3 4 5 6 7 8 9 10 | <?php $fp = fopen('passwd.txt','r'); $fr = fread( $fp , filesize( 'passwd.txt' ) ); preg_match_all('/(.+?):x:(.+?)/',$fr,$explode); print_r($explode); $fp2 = fopen('data.txt','w+'); $fw2 = fwrite($fp2,$content); fclose($fp); fclose($fp2); ?> |
Which is exactly doing all what my damn 53 lined php code does by neither more extensively nor less so !
That time I didn’t identify preg_match_all() function as well as I do now , however it doesn’t matter at all !
If you had a new idea leave comment and if not … be safe !





preg_match_all() is very usefull ;
anyway thanks….
I liked it. So much useful material. I read with great interest.
Valuable thoughts and advices. I read your topic with great interest.