Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I'm not entirely sure I understand your issue or how much I can really help you without seeing the code in the actual context of the page, but based on what you are saying, perhaps try changing the code to this: <script type="text/javascript"> $(document).ready( function() { $('div.photo-overlay').css({'display':'none'}); $('div.preview img').css({'opacity':'1'}); $('li.photo-col').hover( function () { $(this).find('.photo-overlay').css({'display':'block'}); $(this).find('img').css({'opacity':'0.6'}); }, function () { $(this).find('.photo-overlay').css({'display':'none'}); $(this).find('img').css({'opacity':'1'}); } ); }); </script>
  2. not enough info/material to give a definitive answer about the whitespace, but is there any reason why you can't just trim($filename) ?
  3. In any case, we do have a publicly accessible tutorial section on the main site: http://www.phpfreaks.com/tutorials The link Maq provided is a link to the tutorial section located within the IPB framework. We started migrating the tutorials from the main site (my link) to there and just never got around to finishing it. So, it's not accessible to the general public. But I think the main point here is whether or not to re-open up ability to add more tutorials from other members. Currently anybody in Guru+ can add a new tutorial/blog on their own (though we usually encourage them to post it for review first). It's simply not open to regular members ATM. If/when we get off our lazy bums and complete migration to IPB framework, we will likely re-open ability for registered members to submit. Also, if y'all have a tutorial you want to see on the site, you are more than welcome to submit it to us via email or PM to review. We don't (currently) offer any kind of compensation other than seeing your tutorial and name on the site, though offering more than that is definitely on the discussion table for us to consider (one idea we kicked around was offering ability to put up your own affiliate ad so you get impression/click credits for it). But.. in general, I stand by my previous statement that we did in fact at one point have it openly available and there really wasn't any interest in posting, other than from people who had already worked their way up the ladder. So personally my money is on it being the same.
  4. nuh uh, I can see it too.
  5. your wall is a "skeleton" in a 2d array but then as far as actually building it, you create it by filling in a rectangle based on a product (*10) of the coordinates. But then when checking the location of the fruit you are about to draw, you don't take that same *10 into account. You also do the same fill trick for your fruit but don't take into account that it's basically just a dot "skeleton" with a rectangle filled in by *10 factor. So IOW you are basically checking position based on the core "skeleton" points but not offsetting it by both the *10's you created, so you need to factor in current x/y positions *10 + *10. Incidentally, you have the same issue when checking for collision of snake vs. wall. If you look when you collide into a wall, you will see it actually stops in the center of the wall, where the "skeleton" coord is. Again, you are not factoring in the same *10 you used to make the boundaries.
  6. Well, "entry" level is more or less straight forward. You start out as bottom of the totem pole. You will very likely start out with lower pay than everybody else on your level, even the guy sitting next to you with the exact same title if (s)he's just been there longer. Your responsibilities could basically be summed up as "Do what someone (anyone) else tells you to do." Nobody reports to you, you aren't really involved in decision making processes except possibly by virtue of being the only person on the team doing what you do (e.g. being the sole developer of the company). "Senior" level positions usually focus more on project management and decision making than actual coding. Though this is usually highly dependent on work load vs. work resources. Think of it kind of like a shift manager at taco bell. Ideally they shouldn't be running a position (making or taking the order) at all. Ideally they are responsible for making sure the other employees are doing their job, handling problems that come up, doing paperwork type stuff like nightly inventory, etc. But in reality more often than not, someone calls in or there's not enough employees to schedule in general, or maybe things just get real busy, and they have to jump in and help make or take orders. But when you get into terms like "Medium" level.. well things get pretty fuzzy and highly subjective. In my experience, there usually isn't even a title step between "web developer" (or jr. web developer) and "senior web developer". Traditionally, "Senior" is the next step up. After that, you start getting into titles that definitely do not involve actual coding at all, such as project manager, department manager, etc.. and those positions more often than not can be filled by people who don't even actually have real coding experience, because they basically never do any of the actual coding. So perhaps to a degree, "mid" level is the same as "senior" level for your purpose/ambition. Which brings us back to expectations on landing a senior position walking in the door. Overall I get where you're coming from. You aren't some newbie trying to figure out his first "hello world" program. You have a few years experience under your belt and perhaps you even consider yourself an expert at the language(s) and coding practices you know. But my point is that simple knowledge of these things doesn't really warrant walking in with a "senior" title and compensation (pay rate, benefits, whatever), because a huge chunk of that comes from actual tenure with a company. It's like if you were to work at Burger King for 5 years and know their menu and register system inside and out.. and then walk in and apply for a job at McDonalds. Sure, you know the general idea of how to flip burgers and take orders, but the system and menu, food handling procedures is not the same. Can/Will/Should you be able to fastrack to square 2 quickly, given your prior experience? Absolutely. But that doesn't change the fact that you ARE on square one walking in the door, and you DO have that learning curve to overcome. "Actions speak louder than words" is the apt saying here. You can have a mile-long resume that's thoroughly impressive and it will certainly help getting your foot in the door, but most clients try very hard to pay you based on what you've proven to them you can do, not by what you say you can do. And you prove it to them not by showing a list of past experience. Doesn't matter if you can get Bill Gates himself on the phone to verify you are awesome. Bottom line is their company has its own unique issues and code etc.. and proving your mettle to them involves actually working for them. So 9/10 times the way it works is you tell them what you can do (resume), they decide you seem promising enough to gamble on and hire you, then after working with them a while, you start getting raises and promotions based on what you actually do. "Okay, so then how much SHOULD I expect to get paid then?" This is not an easily answered question. In fact, I would say it's not really answerable at all. There are too many factors to consider. Here are a few: - Location. Different parts of the world have different costs of living. For example, people in the Middle East and Asia generally work for substantially less than in America, because the cost of living is substantially less. And someone living in Midwest America usually gets paid a lot less than Someone working in the upper-eastern area. And it's a two-way street. And it's 2-fold. If the company is located in a high cost of living area and you work remotely in a low cost of area, that doesn't necessarily mean they will compensate you based on where they are located. In fact, they will more often than not compensate based on whatever benefits them. They will absolutely bust out the "you live in lower area" card, but if the situation was reversed, they will absolutely bust out the "that's your problem.. move here and work locally" card. - How big the company is. A mom-and-pop company will likely pay less than some corporate giant. On the other hand, a corporate giant is more likely to have a lot more resources and potential candidates and in general be in a better position to offer you a lower wage and if you don't like it.."next!" On the other hand, a well established corporation will likely have well established policies and clear paths forward and can afford to stick to it, and have higher probability of being in business tomorrow. So the chances of you getting paid more sooner or later is higher. - Company track record of employees. A company who has a hard time retaining employees will likely offer higher wages in an attempt to keep people on board. On the other end of that spectrum: if average employee tenure is long, they may hire at higher wages so that there isn't as big a gap between newbie and veteran, in order to keep newbies from leaving. - What the company actually sells vs. what you actually do there. This is sort of broad. For example, if it's some company that primarily sells physical goods/services, and their website is little more than a fancy business card.. well you probably aren't going to have much to actually do. Expect to be paid accordingly. But if the company's website is huge and complex and especially if it's something "unique" to the company, then you should expect to have a lot more to do and therefore get paid more. And on that note... - How unique the company-specific skillset is. I'll use my own industry as an example. I work in Web Analytics. The (implementation) technology is primarily javascript, though it does span other things such as tracking stuff within flash, or via server-side coding, etc.. but for the sake of simplicity, let's keep this example solely on javascript. Now, there is a big difference between someone who knows javascript, vs. a javascript coder who understands the point and principles of analytics. There really aren't a whole lot of web devs out there who even have web analytics on their radar. There are even less that have experience beyond little more than basic c/p implementation "that one time". There's even less who do it regularly, and even less who do it well, especially as far as understanding the reporting side of things. Basically the point is, it's kind of a niche position, and therefore generally demands a higher salary, despite actual coding experience being (somewhat) less demanding. But having said all that.. in general, there are plenty of sites out there that you can look up average salaries for xyz industry/job etc. to get a ballpark figure. For example, most "job hunting" sites (e.g. monster.com, glassdoor.com) provide some insight on that count. These sites mostly rely on people submitting their own experiences, location, etc. In general, those are good places to find ballpark expectations. But like I said, there's so many variables that are unique to each company that you should take it as a grain of salt. Better than nothing, but little more than that. It's kind of like shopping for a car or a house. You can do some research to get a general idea, but in reality it really boils down to sitting in front of the company, figuring out exact expectations on their end, and then trying to sell yourself to them. But the main takeaway here is to focus on getting your foot in the door with them promising to bump you up to that senior position upon proof of working with them, vs. trying to get them to just hand it to you walking in the door, because as Kevin so eloquently put it, if you attempt the latter, more often than not you will just be laughed out the door.
  7. uh yeah, you can use regex for this easy. Only thing you really have to do is double escape symbols that mean something to the regex engine: var replacer = new Array("@", "\\$", "\\*", "drip", "slide", "move", "\\(", "\\)"); replacer = replacer.join('|'); var userInput = "I have to slide down @ $3.00 with all (*) of the $ and moVe to another driping SLIDe"; userInput=userInput.replace(RegExp(replacer,'ig'),'NOPE');
  8. first thing I see that looks wrong is that you have your mouseover and mouseout events only targeting #post-1 element, so they will only trigger on that first image. Seems like you should be able to change your selectors to ".preview" instead of "#post-1" to have them target all of your images (since that class looks common to div wrapped around each image). But that's a side issue. As to the actual issue.. when loadloginPopup() and unloadloginPopup() are called, your jQuery targets class ".photo-overlay" which targets ALL of your elements. So what you need to do is pass a reference to the currently hovered element and use that reference instead. Uh also, you have issues with syntax/placement of your loadloginPopup and unloadloginPopup functions. For starters, you didn't correctly close them (closing } improperly placed). 2nd, you have them wrapped inside the document.ready function which puts it within that jquery scope so they aren't defined when they are actually called (jquery attempts to look for them in global namespace). I don't know how you managed to even see what you DID see, unless you hella typoed posting here... Overall, your code is a bit clunky and can be cleaned up a bit. jQuery provides a .hover() method you can use. So overall, code would look something like this: <script type="text/javascript"> $(document).ready( function() { /* set initial state of things.. */ // this line hides all of the photo detail overlays, since the html you provided has them // all initially shown on page load, and it seems you only want them shown if someone hovers $('div.photo-overlay').css({'display':'none'}); // base on just the presented html, this one isn't necessary, but i threw this in there just // in case you have other code that somehow affects your preview images. So this line is // based on what you had for your mouseleave event $('div.preview img').css({'opacity':'1'}); /* set mouse hover events */ // target .preview class since it's common denominator wrapped around each set of // image and detail elements. enter/leave selectors will be relative to it. $('div.preview').hover( // mouse enter function () { // find and show the photo overlay for the currently hovered image $(this).next('.photo-overlay').css({'display':'block'}); // reduce opacity of the image for the hovered element $(this).find('img').css({'opacity':'0.6'}); }, // mouse leave function () { // find and hide the photo overlay for the currently hovered image $(this).next('.photo-overlay').css({'display':'none'}); // restore opacity of the image for the hovered element $(this).find('img').css({'opacity':'1'}); } ); }); </script>
  9. i can't think of any pre-fab script off the top of my head that does this, but it doesn't sound that complex to make..
  10. p.s. - i'm not trying to deter you from puttin' your feelers out there..just sayin' that in my experience, coding for the corporate world has little to do with actual coding and very much to do with playing the corporate game.
  11. no, it's not the extension.. php doesn't really care about extensions when it comes to this. Are you sure that's the extent of your code? using file_get_contents() on that url I get the xml contents, and doing it via simplexml works for me (as an xml text to just dump file): <?php $file = "http://www.putlocker.com/get_file.php?stream=WyJSVEU0TnpGRE9ERXlOemt6UTBRek5Eb3hNemc1TlRJMU16VTRMalk1TnpNNk5EVTBZVFpoWTJaak0yWmxOVEJtTVRjNU5UZGhORGxqTWpKbFl6Z3hZbUZtT0dSaU1qVmpPQT09IiwicmVnIl0"; $xml=simplexml_load_file($file); echo "<pre>";print_r($xml);echo "</pre>"; ?> I get: SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2.0 ) [channel] => SimpleXMLElement Object ( [item] => SimpleXMLElement Object ( [title] => Video ) ) ) maybe the server is blocking your sever specifically or something...
  12. Well it really depends on how the company defines "senior". I have seen many companies who base those titles solely on tenure with them. It doesn't really matter how well you know a language and coding practices in general. Well it does certainly matter, but that's just an "entry point" requirement in the grand scheme of things. You have to understand that everybody's code and situation is unique. I'm sure you understand this on some level, but it sounds like you don't have much experience to really understand how much having a history and understanding of the context really weighs in comparison, and that comes from experience working with a specific company, not having work experience in general. It's a trap that many in "agency" positions fall into a lot. Myself included. I'll be tasked to audit a client's site and at face value the code looks really shitty and I can't help but wonder how dumb the client's devs had to have been to have done xyz. And it's only after spending some time talking to them and really diving into things like history of emails and why's and how's of things that I begin to understand that development from a company PoV is 5% actual coding and 95% politics. IOW that shitty bandaid/hack you found probably wasn't because the web dev being an idiot, but because they had no choice in the matter due to budget or time constraints, or not being able to touch a certain piece of code, etc. 3-5 years is probably enough to ask for more than entry level wages, depending on how competent you can show yourself to be. And you might be able to negotiate a "trial" period to get up to speed and depending on how fast and well you get up to speed with their history/context, and get fast-tracked to a more senior position. But you're being unrealistic if you expect to be handed something more than an entry level title on day 1. Bottom line is NOBODY is going to drag you to a meeting with a client under the title of "senior" when you've still got a learning curve to overcome. Ideally every level of coder at the company should be proficient in the language and best practices. It doesn't matter if it took you 1 month or 10 years to get to the point of calling yourself "expert" at the language/practices. That's entry level requirement regardless. Nobody hires coders that don't actually know how to code (well they do, but that's because people talk a good game. Ideally they don't). The difference between newbie and senior is having actual history and knowledge of context/policies for the company specifically. IOW you know the syntax - great! So does everybody else there. But do you know WHY they did it this way vs. some other way? etc. It doesn't mean your 3-5 years of experience count for shit. It just means that that's what helps get you in the door. It tells a company that theoretically you a) have a good working knowledge of the underlying technologies, b) have learned a few general tricks and caveats along the way, c) managed to not suck enough to have been able to work the job in general vs. quitting early on. It also tells them you might have less of a learning curve in general, as far as getting up to speed with their situation. But at the end of the day, it's a gamble on their end. There's no guarantee you aren't lying about a given thing on your resume. It's real easy to sound like you know wtf you're talking about, esp since most of the time the interviewer knows very little about the job you are applying for (more office politics). So your experience absolutely means a lot - as far as getting your foot in the door with a decent starting package. And that doesn't mean there's no exceptions. There's always exceptions. It could very well be that you find a place that just lost their coder and they are trying to get *a* coder on board because they have nobody, and you are the "senior" guy by default. It could be that they are about to do major changes like move everything over to a whole new system or otherwise effectively start from the ground up, and perhaps they need someone with experience you have that their current coder(s) don't have. But like I alluded to previously, those exceptions are double edged sword to be weary and suspect of.
  13. okay well I just used printing out the whole file as an example, roughly same as what you did. Getting a specific value within the file is a separate issue. You first need to sort out getting the file to load. The purpose of using file_get_contents is it's a really basic way of just requesting the file and getting the contents, not worrying about parsing it. If it isn't returning what you expect, then it might provide clues to next step.
  14. well i made a test file with the xml contents under a different extension and it loads fine, and it also reads fine. using the following: <?php $xml=simplexml_load_file("etc/test.txt"); echo "<pre>";print_r($xml);echo "</pre>"; echo "<b>name: ".$xml->getName(). "</b><br/>"; foreach($xml->children() as $child) { echo "<b>child: ".$child->getName()."</b><br/>"; echo "<pre>";print_r($child); echo "</pre>"; } ?> output: SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2.0 ) [channel] => SimpleXMLElement Object ( [item] => SimpleXMLElement Object ( [title] => Video ) ) ) name: rss child: channel SimpleXMLElement Object ( [item] => SimpleXMLElement Object ( [title] => Video ) ) so uh.. problem is probably with whatever the server is responding with, for the url you are using. Try just using file_get_contents and echoing that out to see if you are getting what you expect.
  15. TBH I think you're probably being a bit unrealistic if you're trying to shoot for a senior position right out the gate. Not that I'm saying you are/aren't capable, but there's a lot of office politics involved, and even if you include your freelance projects on your resume, that might get your foot in the door as a peon but from my experience, probably isn't good enough to land a senior position. And TBH I'd probably be weary and suspect of working for a company that does offer you a senior position right out the gate like that. It can mean several things. It can mean that the company has no real direction or policy as far as coding is concerned, which will inevitably lead to unrealistic expectations, not enough pay, etc. Or think about if you were the current peon working there and someone walks in as your boss. That shit rarely works out. Either you're "cool" and listen to the peons in which case their opinions of why they aren't running the show are reinforced, or else you tell them shit needs changing, but you don't know the context/history of shit. You're pretty much fucked either way. So basically, even if you have a killer resume, it's usually better to shoot for getting your foot in the door and working your way up, instead walking in as commander-in-chief, unless the "senior" position is more about abstracts, like project management, direction of the company, etc..(which doesn't really sound like what you wanna do anyway?) Also, you aren't going to really find many companies that don't take "forever" to implement stuff. Again, there's a lot of office politics and red tape when it comes to implementing stuff. I swear, I have logged dozens of hours in dozens of meetings across literally months for even the smallest "one liner" things. General rule of thumb is, bigger the company, longer shit takes to get done. Exponentially. So on that note, if you're looking for a faster pace, I suggest you skip trying to jump on board with an individual company, and try shooting for getting in with an agency or some other company that's all about providing code/support for other companies. Basically it's kinda the same principle as freelance work, but you focus on the coding while other people on the team focus on landing the clients.
  16. Why can't you mention your freelance work on your resume? As long as you aren't trying to puff it up to something unbelievable like claiming you single-handedly dev'd facebook or something.. Even if you can't post a direct link or include phone numbers (which you shouldn't really do anyways), you can still mention the projects and what all you did. This is where you are wrong. 99% of the time, resumes aren't really about proving you did xyz. Even if you could link to xyz.com, that doesn't prove you did it. Resumes are about summarizing your experience and qualifications. Even if/when you get called for an interview, it's not so much about proving you did xyz as showing that you know wtf you are talking about, especially how it can be usefully relevant/applied to the company's needs, and presenting yourself in a way that makes them like you. And "Showing you know wtf you're talking about" rarely involves pointing at xyz.com or some chunk of code you did. Handing someone code doesn't prove you did it or didn't just c/p it. It usually involves answering whatever scenario/knowledge questions they throw out at you, or completing some "test" they've devised.
  17. Welp, I finally bought a house on some land last year, so I can scratch that off my yearly new year's resolutions. So I think this year's list will involve doing things to make me more self-sustainable, e.g. plant a veggie garden, dig a moat, install solar panels, etc. I figure the veggie garden is definitely doable. I think the solar panel thing might have to be amended to just "start saving up for..". The moat thing.. well I have a handful of kids who like to get in trouble a lot, so here's me thinking ditch-time might be their new punishment
  18. True, but that doesn't mean we aren't human and can't put in our 2 cents based on our own experiences. As long as she understands that we aren't licensed professionals in that sort of thing - though ultimately it's her decision on what to do about it, regardless of who's telling her. The promise may or may not have been unreasonable, but if he promised it, that's on him. Personally, I do not think it's an unreasonable thing to ask of someone to not live with people who they may have or grow to have attraction for. IMO. Even if they are trustworthy, why tempt fate? There's a reason why recovering alcoholics aren't supposed to go hang out at bars. I've been married for 14 years so far. The wife claims it's okay to go to pr0n sites and titty bars if I want. No way in hell would I. It's really easy to say you will or won't do something. Quite different to actually do or don't when put in a given situation. You shouldn't put yourself in situations where you can be tempted. It's like playing with fire.. I will agree that you shouldn't be in a relationship with someone you don't trust, but there is a big difference between being around friends and coworkers vs. living with them.
  19. I'm confused, need more details. Why exactly must he have a female roommate? Is it because there's a certain female willing to be his roommate, and he can't find a guy to roommate with, or is there some kind of actual law/policy involved? Did he have a roommate who left? Did he lose his job or rent go up and can't afford it anymore? I guess I'm unclear as to why he would actually get evicted if he does not get a female roommate. That seems kind of shady to me.. there's no laws like that in America (though there is a law about non-married opposite sexes sharing the same bedroom, but if anything that would work for the opposite of his claims. Are you in America?). Also, it seems to me that if there really was some kind of law/policy involved, he wouldn't have promised you that in the first place. In my experience, my money is on his eyes being on another girl. Or trying to ditch you. Or some variation. You know the saying, "If it looks like a duck, quacks like a duck.." But I'm just some random stranger on the internet, so take that for what it's worth.
  20. The / at the beginning and end is the pattern delimiter. All PCRE function(preg_xxx) patterns must be wrapped in a delimiter. This is because you can add pattern modifiers, and those are also specified in the first argument: "/pattern/modifiers". The delimiter doesn't have to be /. It can be pretty much any non-alphanumeric char, as long as they match up (well.. you can also use brackets in which case you'd use them as opening/closing pairs, but let's not open that can of worms). For example, these are the 3 most common delimiters you will see: /pattern/modifiers ~pattern~modifiers #pattern#modifiers / is popular because it is the only delimiter you can use in some languages. For example, javascript uses / to delimited a regex object and you can't use anything else. IOW it's the most "universal" delimiter. The main thing to remember about the delimiter is that if you need to use that symbol in your pattern, you must escape it (prefix it with a \). IOW it works basically like quotes for strings. A good chunk of the time people work with regex (in php), they are trying to parse html (which isn't necessarily a good idea, but that's a different discussion). As you probably know, html contains a lot of forward slashes, so rather than having to deal with escaping them (which isn't *that* big a deal, but it does technically make for a longer and uglier pattern), a lot of people instead use something else (like the tilde or hash). The ^ in this context is an anchor, signifying the start of a string. For example, let's say you have the following string: "foobar" And your pattern is /^bar/. This pattern says to match for beginning of string, followed by "bar". So this pattern would not match your "foobar" string, because "bar" is not at the beginning of the string. The counterpart to ^ is $, which stands for "end of string". So for example, if your pattern is /bar$/ it would match, because "bar" is at the end of "foobar". One thing to note that ^ can mean other things, depending on the context. If you use the m modifier (multi-line mode), ^ and $ will change to mean start and end of line, respectively. IOW it will match against newline chars instead of string start/termination. ^ is also used within a character class, to signify a negative character class. For example, [0-9] will match any one digit. But [^0-9] will invert that. It will match any one character that is not a digit. The * is a quantifier. A quantifier tells the regex engine to match the preceding thing for x amount of times. * means 0 or more times. So in your example, [a-zA-Z ]* says to match for 0 or more lower/uppercase letters or spaces. So overall, the pattern: "/^[a-zA-Z ]*$/" says start at the beginning of the string and match 0 or more letters or spaces until end of string. So if the pattern matches, that means $name only contains letters and spaces. One a sidenote, I mentioned modifiers, and there is opportunity to improve this pattern with the "i" modifier. The "i" modifier makes the pattern case-insensitive. So the pattern can be shortened by doing this: "/^[a-z ]*$/i" "(-@+" isn't in the example, so I'm not sure what you're confused about. Things preceded with a backslash are called escape sequences. What it is depends on the context. For example, if I used / as my pattern delimiter and wanted to match a closing html anchor tag, I'd have to do this: "/<\/a>/". In this context, I'm simply escaping the forward slash in my pattern to tell the regex engine to look for a literal forward slash, instead of think it's the end of my pattern. Some escape sequences are shorthand character classes. For example, \w will match any "word" character, and is the equivalent of [a-zA-Z_]. Well, it's a little more complicated than that (read the entry for it in the link above). So this last chunk of code you posted.. actually, it doesn't make much sense. Overall it looks like the intention is to validate a url. I *assume* test_input() is supposed to do this.. but then why turn around and have regex validation after that? IOW even out of context, this code has an "improperly structured" vibe to it. Anyways.. So the regex itself.. again, under the assumption that it's supposed to be validating a url.. this pattern is bad. You can go here and enter in the pattern to get a breakdown of it.
  21. 1) how is that string even working for you.. you are using double quotes for the string delimiter and your value also has double quotes in it that you aren't escaping...you might want to look into using HEREDOC syntax. 2) post your actual code.
  22. $subject = 'ds WSW 16km/h. Humidity will be 97% with 28km/h. . .'; $subject = preg_replace_callback( '~\b(\d+)km/h\b~i', function($m){return round($m[1]*.6214).'mph';}, $subject );
  23. preg_match('~\b\d+km/h\b~',$string,$match);
  24. okay well the way your regex is currently written, you expect a single unicode letter, followed by 1 or more unicode letters, dots, spaces or hyphens, and then followed by 1 unicode letter. So IOW currently it won't allow for the string to start or end with a period (or any of your other non-letter chars). If you just want to match for those things regardless of position, do this: return preg_match("/^[\p{L}. -]+$/u", $name);
  25. actually i lied about the stacking data. I noticed you're opening the file in "wb" mode. the "w" overwrites the entire file each time you open it so you're effectively getting what you want on the last iteration of the loop. However, that's not very efficient. You should still change the .= to = and use "a" instead of "w". This will open the file and put the pointer at the end of the file and append to it. That way you don't use extra memory holding a stacking $content value.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.