What's the difference of echo,print,print_r in PHP?
I use echo and print_r much,almost never use print. I feel echo is a macro,and print_r is alias of var_dump. But that's not the standard way to explain the difference. ...
I use echo and print_r much,almost never use print. I feel echo is a macro,and print_r is alias of var_dump. But that's not the standard way to explain the difference. ...
I´m sorting by Price, look: SELECT Price FROM re2_listings ORDER BY Price asc Result: 1.200.000,00 1.500.000,00 200,00 3.000,00 ...but the correct way is: 200,00 3.000,00 1.200.000,00 1.500.000,00 Understand? How to do this? ...
I am using PHP and I have an array of user images that I need to filter. I need to do 2 different filters: Look in original array and see if each value contains a value in my "bad words" array Look and see if the value in the original array ends in one of "bad extensions" values Images Array: Array ( [0] => smiles.gif ...
I want to conform my site's string handling to support other languages per UTF-8. It seems that the best way to do this is to forsake all the standard string functions. So I have two options, I can set the mbstring.func_overload option in php.ini or I can go back over my code and just replace all the functions with mb_*. I would assume ...
I have a line of PHP code that does the following: $xml = "<xml><request>...[snipped for brevity]...</request></xml>"; $request = pack('N', (strlen($xml)+4)).$xml; What this appears to do is prepend a binary string of the length of $xml (plus 4) to the value of $xml. How do I do the equivalent of this in C#? ...
Hi, i have a list of say courses and certificates and fun_days. These are all called objects. Every object has its requirements object_requirements. A requirement can be either one of the objects or several of them. You can take any object without object_requirements as a starting point. "Everybody is allowed to have those objects." S...
Is there any easy way to print Flash Charts (Open Flash Charts 2) within a web page. Flash doesn't seem to print at all. I'm maintaining a health site for a client, and we use Open Flash Charts to draw multiple line charts for patients dynamic data. The client would like for patients to be able to easily print these charts, although Fla...
Hello everyone, I would like someone to explain me what _forward is exactly doing, I cannot see if _forward is also rendering the attached view to the action or just executing the action. Also is it possible to pass argument to $this->action in a view script ? More generally my problem is how to code a confirmation page, let's say t...
I need to insure that all my strings are utf8. Would it be better to check that input coming from a user is ascii-like or that it is utf8-like? //KohanaPHP function is_ascii($str) { return ! preg_match('/[^\x00-\x7F]/S', $str); } //Wordpress function seems_utf8($Str) { for ($i=0; $i<strlen($Str); $i++) { if (ord($Str[$i]) ...
Does anybody know offhand the way to tell whether I'm being called statically (Classname::function) or inside an object ($classInstance->function) inside a PHP method? ...
Hi there, first of all, my main question: What are some good troubleshooting techniques when you run into a variable problem regarding slow database access. Background: I have a system that is handling multiple db connections so that I may use unbuffered queries on the main table select. I have an issue where I see a pause on a very si...
Hello, Here is the situation : we have to offer a customer with a web-based search engine that will make a search for a given string inside a list of documents whose paths are logged in a database. The supported documents are PDF, Word, Excel, TXT. So we have 2 options : PHP ASP Anyone heard of any good open-source solutions regar...
ok, so what i'm trying to do is to scan the "previous" folder. $scanned = scandir(".."); foreach($scanned as $file){ if(is_file($file)){ print $file."<br />"; } } even though in my ".." directory i have 20+ files i get just three rows index.jpg index.php template.dtd i noticed that if i don;t use that is_file if clause it re...
I have a PHP script that acts as a JSON API to my backend database. Meaning, you send it an HTTP request like: http://example.com/json/?a=1&b=2&c=3... it will return a json object with the result set from my database. PHP works great for this because it's literally about 10 lines of code. But I also know that PHP is slow and...
I'm using the below headers on my web site but I'm running into a problem. The first time I visit my site for the day I don' tsee my ACP link. There are also instances where information is in our database that only registered members can create, but the form is still being loaded for non-logged in users so information is being created ...
I'm trying to split a string on its punctuation, but the string may contain URLs (which conveniently has all the typical punctuation marks). I have a basic working knowledge of RegEx, but not enough to help me out here. This is what I was using when I discovered the problem: $text[$i] = preg_split('/[\.\?!\-]+/', $post->text); (this ...
Hey there, I'm wanting to do something similar to this: http://stackoverflow.com/questions/594112/matching-an-ip-to-a-cidr-mask-in-php5 Except, I want to store a list of disallowed IP/Masks in a MySQL table and check for a match. Just like the example in the link, something like '10.2.0.0/16' would be a row in the table and then I wan...
My client needs to have a banner management system installed to their site. They want the system to be able to manage banners based on time (i.e. a client purchases an ad for 3 months, the site needs to not display that ad after 3 months time even if we don't change any settings) It also needs to integrate into our website. We have the ...
How to get a website information through PHP. Not using file_get_contents Is there any other way to get the website information. example URL: http://www.quarkbase.com/google.com In this page you will get whole information about the GOOGLE page. Like this If i enter any URL of a site i need to get the More information regarding...
While writing code in a file that would comprise of PHP, HTML, CSS & JavaScript, in what order each must appear? What are the best practices for separating the presentation and the logic? Sometimes external .js and other files are using in the link tag. Where these link tags must appear? ...