[Solved] What effect does this code in PHP? [closed]

[ad_1] As you pasted it in one liner <?php session_name(‘MoodleSession’.$CFG->sessioncookie); //设置当前session名称为MoodleSession /* * */ if (check_php_version(‘5.2.0’)) { session_set_cookie_params(0, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure, $CFG->cookiehttponly); } else { session_set_cookie_params(0, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $CFG->cookiesecure); } the only executed function would be session_name(‘MoodleSession’.$CFG->sessioncookie); because you are commenting the rest of the line with a // What does this piece of code? … Read more

[Solved] laravel/framework 9.x-dev requires php ^8.0 -> your PHP version (7.4.13) does not satisfy that requirement [closed]

[ad_1] Composer is telling you what is wrong. It wants PHP8 and you offer php7.4, so it doesnt install. From the comments it also says that laravel 9 is in development. As you’re stuggling with this, I dont recommend using that version and go one back, using 8. What I recommend doing (and what I’ve … Read more

[Solved] Take value from array which is in array [duplicate]

[ad_1] That’s a simple array containing another array so you can simply specify multiple indexes for included array: $mc_name = $_GET[‘identifiers’][‘mc’][‘nick’]; To better understand how it works think of it like assigning each array first to a variable like: $identifiers = $_GET[‘identifiers’]; $mc_array = $identifiers[‘mc’]; $mc_name = $mc_array[‘nick’]; which will essentially do the same thing … Read more

[Solved] i want to save my Html table data in mysql table in php [closed]

[ad_1] Time to study. PHP With PDO (here you can work with databases using PHP): http://php.net/manual/pt_BR/book.pdo.php Use a POST form to save the data. You need to put each td value inside of a input. http://www.html-form-guide.com/php-form/php-form-post.html You need to create a database (http://dev.mysql.com/doc/refman/5.5/en/create-database.html) and a table (http://dev.mysql.com/doc/refman/5.1/en/create-table.html). And finally insert command, to add the values … Read more

[Solved] Fetching last 200 records from table [closed]

[ad_1] include the order by clause to get the last 200 records. SELECT c.member_id,c.message_id, fm.firstname AS fname, up.gender, TIMESTAMPDIFF( YEAR, up.dob, NOW( ) ) AS age, c.upload_img, c.image, c.message_id AS msg_id, c.message AS msg, c.posted_timestamp AS time, c.topic_id AS topic_id, u.croppedpicture_filename,u.picture_filename FROM conversation_messages_tbl c, user_profileinformation_tbl up, user_tbl u, family_member_tbl fm WHERE c.member_id = fm.family_member_id AND … Read more

[Solved] Cannot run a simple PHP file on the server [closed]

[ad_1] Have you installed PHP? – If so do the following: Start off by trying a simple script – call it say info.php: Ensure (assuming Apache) that you have it the web server configured – see http://php.net/manual/en/install.php If all this works then there is a problem with the script. [ad_2] solved Cannot run a simple … Read more

[Solved] array_unique not removing duplicates

[ad_1] Just change $input = array($mfgName, $prodModel, $name); into $input = array_merge(array($mfgName, $prodModel), explode(” “,$name)); This splits the string $name in an array and array_unique works as intended. 0 [ad_2] solved array_unique not removing duplicates

[Solved] Regex for Username and Password verification

[ad_1] You need to anchor your pattern and use lookahead to validate those cases. if(preg_match(‘/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[a-zA-Z0-9@:.]+$/’, $username)) { … } (?= … ) is a zero-width assertion which does not consume any characters on the string. Therefore, It only matches a position in the string. The point of zero-width is the validation to see if a … Read more

[Solved] How to Parse JSON with PHP?

[ad_1] You need do it in following manner:- <?php $data=”{ “metrics”: { “timers”: [ { “name”: “com.android.timer.launchtime”, “startTime”: 1232138988989, “duration_ms”: 1900 }, { “name”: “com.android.timer.preroll-load-time”, “startTime”: 1232138988989, “duration_ms”: 1000 } ] } }”; $new_array = json_decode($data); //convert json data into array echo “<pre/>”;print_r($new_array); //print array foreach ($new_array->metrics->timers as $new_arr){ // iterate through array echo $new_arr->name.'<br/>’; … Read more