php-5.2

Is it a bad idea to have Git repository in production server

痴心易碎 提交于 2021-02-08 06:29:14
问题 We have a Windows Server 2012, Apache, PHP, and MySQL. The server is a bit a mess. One of the things that I want is to track the changes on the code. Normally I don't set up Git on the server, instead I develop on the local machine then using SSH I deploy changes to the production server. However this Windows Server 2012 was not set up by me and thus it is a bit mess. I cannot copy the PHP code and develop it in my machine because it runs on PHP 5.2 and the code is encrypted. Thus, I think I

Validate email or mobile with regular expression

≯℡__Kan透↙ 提交于 2020-04-07 06:33:05
问题 I have one form field. In that field it's possible for user to enter EMAIL or MOBILE . From a PHP page i got value. After that i want to check whether this is email id or mobile number. suppose email means i want to email success,suppose mobile means i want to show mobile success ,i think we have to write regular expression,but i don't know how to write regular expression for this problem? <form action="#" method="POST" id="forgotForm"> <div class="form-group has-feedback"> <input type="text"

PHP Object Life Time

╄→尐↘猪︶ㄣ 提交于 2020-01-13 02:15:14
问题 I am using PHP 5.2. If I new an object at one page, when will this object be destructed? Is the object destructed automatic at the time that user go to another .php page or I need to call __destructor explicitly? 回答1: It will be destructed (unloaded from memory) at the end of the page load, or if you unset all references to it earlier. You will not have to destroy it manually since PHP always cleans up all memory at the end of the script. In fact, you should never call __destruct yourself.

PHP Object Life Time

梦想与她 提交于 2020-01-13 02:15:10
问题 I am using PHP 5.2. If I new an object at one page, when will this object be destructed? Is the object destructed automatic at the time that user go to another .php page or I need to call __destructor explicitly? 回答1: It will be destructed (unloaded from memory) at the end of the page load, or if you unset all references to it earlier. You will not have to destroy it manually since PHP always cleans up all memory at the end of the script. In fact, you should never call __destruct yourself.

“unexpected T_PAAMAYIM_NEKUDOTAYIM” on one computer but not another with PHP 5

烂漫一生 提交于 2020-01-11 12:22:18
问题 My local computer runs PHP 5.3.2, while my server runs 5.2.5. I get Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM with $productsIterator = $productModule::load(Phlex_Db_Order::Asc('name')); I assume the error happens because PHP 5.2.5 doesn't support $stringClassName::methodName() syntax. Does anyone know either 1) a workaround or 2) some other reason this is happening? 回答1: One workaround will be call_user_func(array($productModule, "load"), Phlex_Db_Order::Asc('name')); or,

PHP date_parse_from_format( ) alternative in PHP 5.2

强颜欢笑 提交于 2019-12-30 05:04:52
问题 Since date_parse_from_format( ) is available only in PHP 5.3, I need to write a function that mimics its behaviour in PHP 5.2. Is it possible to write this function for PHP 5.2 and make it work exactly the same way that it does in PHP 5.3? Example: For this input: <?php $date = "6.1.2009 13:00+01:00"; print_r(date_parse_from_format("j.n.Y H:iP", $date)); ?> I need this output: Array ( [year] => 2009 [month] => 1 [day] => 6 [hour] => 13 [minute] => 0 [second] => 0 [fraction] => [warning_count]

Problem in getting contents/ files using file_get_contents from url or Problem in reverse geo coding

大城市里の小女人 提交于 2019-12-25 09:42:27
问题 I am trying reverse geocode using google api in php script(using xmlrpc).I wrote the following code in my local system its works fine,but when I try in our webserver it fails. function reverseGeoCode() { $url = "http://maps.google.com/maps/geo?json&ll=".$lat.",".$long; $data = file_get_contents(urlencode($url)); if ($data == FALSE) { echo "failed"; } else { echo "success"; // parsing the json/xml ... } } I got the o/p "failed" my local php: php5.3.6 and webser is 5.2.9. Since it continously

Is there a functional equivalent to mysqli_fetch_all in PHP 5.2?

核能气质少年 提交于 2019-12-24 05:46:07
问题 So, I am a total n00b at PHP (and back-end programming in general), but I never the less decided I wanted to build a functioning database that users could search client-side as th final project for my first web dev class. Anyway, I made my site and database on a localhost, and though it took a while, I got everything functioning perfectly. When I tried to move it to my webhost, however, everything started breaking because, previously unbeknownst to me, the webhost is using PHP 5.2. I've been

PHP 5.2.x: $_POST is empty when any field has value of “drop anywords from anywords”?

蓝咒 提交于 2019-12-24 01:53:14
问题 Very weird bug! When at least 1 form field has value of "zeroOrMoreWords drop oneOrMoreWords from oneOrMoreWords", the $_POST comes empty! Just to confirm to myself I'm not crazy, I tried the same thing on another website that uses PHP 5.2.11 and happens the same thing! I tried: PHP 5.2.8 = $_POST comes empty. PHP 5.2.11 = $_POST comes empty. PHP 5.2.14 = Works fine. PHP 5.3.5 = Works fine. Any explanation to this weird thing? Here's a live example on a famous website: https://www.deviantart

Closure objects within arrays before PHP 5.3

荒凉一梦 提交于 2019-12-22 09:17:48
问题 I know it's possible to do the following with PHP 5.3 (anonymous functions), but is there a similar alternative in older PHP version (pre-5.3)? $exampleArray = array( 'func' => function() { echo 'this is an example'; } Is it possible to do this with __call or typecasting the function as an (object) first? Also, I tried making the function un-anonymous by giving it a name, but this didn't seem to work. 回答1: If you want to create anonymous in PHP < 5.3, you can use create_function function.