Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-27-2004, 06:33 PM   #1 (permalink)
falsepride
Regular Contributor
 
Join Date: Oct 2004
Posts: 219
falsepride is on a distinguished road
your most use function

in this thread i was hoping everyone could share thier most use php function with everyone else. mite actually help some people in the future. my most useful one is, that i use so many times i can't count is(it's really 2 but i only split it, becuase in the end it saved me space.):

Code:
function readintostring($filename) {
  $final = "";
  $file = file($filename);
  array_shift($file);
  foreach($file as $line) {
    $line = trim($line);
    $final .= "$line"; 
  }
  return $final;
}
function readintomdarray($filename, $safecharacter1, $safecharacter2) {
	$mdarray = array();
	$file = readintostring($filename);
	$temp = explode($safecharacter1, $file);
	array_pop($temp);
	$length = count($temp);
	for ($i = 0; $i < $length; $i++) {
		$mdarray[$i] = array();
		$temp2 = explode($safecharacter2, $temp[$i]);
		$length2 = count($temp2);
		for ($i2 = 0; $i2 < $length2; $i2++) {
			$mdarray[$i][$i2] = $temp2[$i2];
		}
	}
	return $mdarray;
}
falsepride is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
function help falsepride PHP 3 11-22-2004 06:21 PM
Custom function bdl PHP 3 03-07-2003 05:53 PM
pass filename to function Blaqb0x Standard C, C++ 1 09-02-2002 10:12 PM
trouble calling auxiliary function in a class brtklt Standard C, C++ 0 07-18-2002 05:22 PM


All times are GMT -8. The time now is 02:09 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting