scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
Oops, I guess I misunderstood you. Your first example would work actually ($d=$Array3[$Array2[$Array1[$a]]]). What are you trying to do?
-
Strip characters from aray results, reorder, display top result
scootstah replied to sleepyw's topic in PHP Coding Help
This seems to work (requires PHP>=5.3): $array = array('abc1234', 'def5678', 'ghi9012'); $array = array_map(function($x){ return substr($x, 3, 4); }, $array); echo max($array); -
Yes, this is a valid example: $a = array('a1', 'a2', 'a3'); $b = array('b1', 'b2', 'b3'); $c = array('c1', 'c2', 'c3'); $d = array($a, $b, $c);
-
'#\[url=(.*?)\](*?)\[\/url\]#' You missed a period in the second group.
-
Your patterns need delimiters at the beginning and end of them. '#\[b\](.*?)\[\/b\]#' Etc. EDIT: Your pattern is also incorrect, and won't match anything. You most likely want to put a period in the group. See the edited code above.
-
Both my desktop and laptop are running Windows 7. I use both for coding and doing whatever quite a bit. I'm really sick of having to reconfigure things on both machines if I mess with something. For example if I find a cool new Firefox extension, I have to download it on both machines. So I thought it would be pretty neat if I could sync up some of my applications (like Firefox, Chrome, Eclipse, Notepad++... you get the idea) so that any changes to the config files on one machine will automatically effect the other. My idea was basically this: have an application where I can set directories/files to watch on my desktop and laptop. If those files ever change, automatically send them to my file server. Both machines watch the file server for changes and if changes are found it will download the newer files. The reason for doing it this way over just directly sending it to the laptop/desktop is that both machines might not be on at any one time, but the file server is always online. Does anything like that exist? I'm not real keen on coding that type of stuff.
-
The most you can do is make sure mail() ran without errors. There is no way to reliably tell if the mail was actually delivered.
-
How do i use function from the same class?
scootstah replied to john_doemoor's topic in PHP Coding Help
I don't really understand your question. The $this object exists to use methods from within an instantiated class object. To illustrate that, take a look at this example: class Person { public function get_first_name() { return 'John'; } public function get_last_name() { return 'Doe'; } public function get_full_name() { return $this->get_first_name() . $this->get_last_name(); } } -
True story. Listen to this man. I tried using this but it sent the browser into a indefinite loop and eventually ended in a browser alert saying something along the lines of "This page is trying to redirect in a way that will never load.". It would work fine for URLs that have the question mark in them, but I'd end up with the alert on pages that didn't. So index.php?signup would redirect to /signup, but /signup would never actually load because it lacked the question mark. Or atleast that's what it seemed like was going. This is what I was using: if(isset($_SERVER['QUERY_STRING'])){ $key=$_SERVER['QUERY_STRING']; } Using the method you posted I have no issues what so ever. $_SERVER['QUERY_STRING'] is always "set", but it will be an empty string if no query string is present. So, you need to check if it is empty and not set. if (!empty($_SERVER['QUERY_STRING'])) { $key = $_SERVER['QUERY_STRING']; }
-
True story. Listen to this man.
-
Well, we'll just have to pretend it isn't.
-
The following will give you the query string if one exists: if (array_key_exists('query', $url = parse_url($_SERVER['REQUEST_URI']))) { $key = $url['query']; }
-
The error means that there is no numerically-indexed array returned by explode(), which probably means the URL doesn't contain a "?". What exactly are you trying to do?
-
I ran getimagesize() against my previously mentioned 1x1px image @ 43 bytes and there's no problems. I don't know what your problem was, but I'm going to take a shot in the dark and say you weren't testing a valid image.
-
1. You can't return things from a constructor. 2. PDO doesn't have a "real_escape_string" method.
-
Pretty URL's remove the need to use querystrings.
-
Why would users be seeing MySQL errors in the first place?
-
Did you set the namespace in the class file?
-
Did you read any of these?
-
Yeah, it seems to be down for me too. However, if you need to look something up just Google it and use the cached version.
-
This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=360697.0
-
Or it wasn't an image at all.
-
Tattoo artists must love these.
-
Put the full message in an email or not?
scootstah replied to The Little Guy's topic in Miscellaneous
A. I absolutely hate mobile web browsing, so I would much rather read a PM in my email than have to load the webpage to read it. That's the only time I could see it being a real problem, at least for me. But if you're going to bother sending me an email at least make it worth it.