Third_Degree
Members-
Posts
281 -
Joined
-
Last visited
Never
Everything posted by Third_Degree
-
oh well I guess it wasn't the wrong thread after all, you just changed your post. To answer your first question <?php $str = explode( '.', $stuff ); print $str[0]; ?>
-
wrong thread. sorry.
-
http://phpbench.com indicates that it doesn't matter much. interesting
-
To create a pdf file and send as an attachment thru mail
Third_Degree replied to rekha's topic in PHP Coding Help
Whichever library you end up using, you have to make sure the extension is loaded. -
What's 'optimized' about it? And why print over echo? Theoretically, echo should be faster than print (because print is a function, echo a construct), though no-one has been able to produce a conclusive benchmark to support it. 1.print is not a function...http://www.php.net/print 2.Also, PHP was born from C, and C uses print... 3.Lastly, echo checks for parameters whereas print does not, so the return value vs. the check evens out timewise (roughly) Single quotes parse faster than double quotes, you can get conclusive proof of that looking at the php source, this is also why i concatenate how I do. Overall, I guess it's just my programming roots in C coming out in PHP.
-
How do you feel when your webhost goes offline?
Third_Degree replied to MasterACE14's topic in Miscellaneous
To answer the question: 1. Period. -
Well I'll add my two cents I like to call it "pretty but optimized" <?php if ( function( $parameter, $parameter ) ) { print 'Hey ' . $var; } else { print ( 10 / 5 ) + ( 12 / 6 ); } ?> Always print over echo, always single over double quotes, always spaces after parentheses.
-
<?php if ( empty( $_POST['user'] ) || empty( $_POST['pass'] ) ) { ?> <form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post"> Username: <input type="text" name="user" /><br /> Password: <input type="password" name="pass" /><br /> <input type="submit" value="Log In" /> </form> <?php die( ); } if ( $_POST['user'] == 'CorrectUser' && $_POST['pass'] == 'CorrectPass' ) { print 'Correct!'; } else { print 'Incorrect'; } ?>
-
imagestringup() ...
-
Finding a location within X miles/km of an postal code
Third_Degree replied to rondog's topic in FAQ/Code Snippet Repository
I guess I misunderstood the OP then -
well if you open the file with the file() function, moving around an array is easy...
-
Finding a location within X miles/km of an postal code
Third_Degree replied to rondog's topic in FAQ/Code Snippet Repository
I don't think he was really asking for that, he already has the zip codes and mentioned nothing about distance. Anyway just get all the zip codes out of the db and use php to compare the strings. -
This thread probably should have been put in javascript, but i agree with ratcateme, if you didn't know that, start googling for javascript and draggable (is that a word?) elements.
-
To create a pdf file and send as an attachment thru mail
Third_Degree replied to rekha's topic in PHP Coding Help
Use the pdf library. http://php.net/pdf_begin_document -
http://php.net/fseek http://php.net/rewind
-
Well if the server's deciding what to show you, there's not much you can do. Also, I copied the source of both of the pages (original and test.php) and ran a comparison script and they were the same...
-
All you have to do is change your url to http://111.com/update.php?id=whatever
-
<link href="/inc/css/site.css" media="screen" type="text/css" rel="stylesheet"> That line's your problem I think.
-
This as I said is a big job. Easiest way to do it is look in the original page source to see where it needs the css or whatever, and str_replace that another page on your server that forms a curl request to that page.
-
umm...something like this...not sure what you're trying to do $file = file( 'file.txt' ); foreach( $file as $line ) { run_function( $line, '1', '1' ); }
-
$sql = "INSERT INTO `transactions` ( `userid`, `accountid`, `amount`, `description`, `date` ) VALUES ( '" . $userid . "', '" . $accountid . "', '" . $amount . "', '" . $description . "', '" . date( 'Y-m-d' ) . "'" ); mysql_query( $sql ) or die( mysql_error( ) ); Try it?
-
Well clearly somewhere in the source a tag is looking for css/javascript/something from another page on their original server which is not found on yours. You'll need to parse the html somehow and then make another request to the site for the css or whatever it is.
-
the file() function already returns an array...
-
Why make them wait longer then they have to, pretty inconvenient. Well thorpe already mentioned it's not possible, but the OP still wants it, so I'd tried to help. I agree it's a waste of time though.
-
well, you could fake it. Use CSS to make everything invisible, display your progress bar, then after how ever long your progress bar takes, make the javascript show all your content by changing the css.