LMSouq

Knowledge Base

Browse Moodle Solutions

Clear

366 solutions found in php-dev

Page 10 of 19
0 votes
2 ans
34 views
What does yield mean in PHP?

I've recently stumbled over this code: function xrange($min, $max) { for ($i = $min; $i <= $max; $i++) { yield $i;...

php-dev Solved
GO
asked 5 months ago by Gordon
0 votes
3 ans
30 views
Class 'DOMDocument' not found

I've found an error on a page in my Magento application; it always show this message error when I visit it: > Fatal error: Class 'DOMDocument'...

php-dev Solved
WS
asked 5 months ago by ws_123
0 votes
3 ans
34 views
How can I get the current script file name, but without the extension ".php"?

If I have PHP script, how can I get the filename of the currently executed file without its extension? Given the name of a script of the form "jquery.j...

php-dev Solved
AL
asked 5 months ago by Alex
0 votes
2 ans
25 views
Where is PHP.ini in Mac OS X Lion?

I wanted to run some PHP right on my Mac, uncommented httpd.conf, activated web sharing, installed MySQL etc. I can't seem to find my PHP files, most impor...

php-dev Solved
OR
asked 5 months ago by Orun
0 votes
3 ans
34 views
How can I sort arrays and data in PHP?

> This question is intended as a reference for questions about sorting arrays in PHP. It is easy to think that your particular case is unique and worthy of a...

php-dev Solved
DE
asked 5 months ago by deceze
0 votes
3 ans
31 views
Simplest way to profile a PHP script

What's the easiest way to profile a PHP script? I'd love tacking something on that shows me a dump of all function calls and how long they took, but...

php-dev Solved
MA
asked 5 months ago by Mark Biek
0 votes
2 ans
30 views
Laravel: How to Get Current Route Name? (v5 ... v7)

In Laravel v4 I was able to get the current route name using... <!-- language: php --> Route::currentRouteName() How can I do it in **Laravel...

php-dev Solved
MD
asked 5 months ago by Md Rashedul Hoque Bhuiyan
0 votes
2 ans
30 views
What is the most accurate way to retrieve a user's correct IP address in PHP?

I know there are a plethora of **$_SERVER** variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to m...

php-dev Solved
CO
asked 5 months ago by Corey Ballou
0 votes
3 ans
29 views
Convert a comma-delimited string into array of integers?

The following code: $string = "1,2,3" $ids = explode(',', $string); var_dump($ids); Returns the array: array(3)...

php-dev Solved
CW
asked 5 months ago by cwal
0 votes
2 ans
32 views
How to read if a checkbox is checked in PHP?

How to read if a checkbox is checked in PHP?

php-dev Solved
TH
asked 5 months ago by Thew
0 votes
3 ans
33 views
Are arrays in PHP copied as value or as reference to new variables, and when passed to functions?

1) When an array is passed as an argument to a method or function, is it passed by reference, or by value? 2) When assigning an array to a variable, is the n...

php-dev Solved
FR
asked 5 months ago by Frank
0 votes
3 ans
29 views
How can I prevent XSS with HTML/PHP?

How do I prevent [XSS][1] (cross-site scripting) using just HTML and PHP? I've seen numerous other posts on this topic, but I have not found an article t...

php-dev Solved
TI
asked 5 months ago by TimTim
0 votes
2 ans
31 views
PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment: Warning: POST Content-Length of 8978294 bytes exceeds...

php-dev Solved
NO
asked 5 months ago by novicePrgrmr
0 votes
2 ans
28 views
How to get first 5 characters from string

How to get first 5 characters from string using php $myStr = "HelloWordl"; result should be like this $result = "Hello";

php-dev Solved
FA
asked 5 months ago by faressoft
0 votes
3 ans
32 views
Convert timestamp to readable date/time PHP

I have a timestamp stored in a session (1299446702). How can I convert that to a readable date/time in PHP? I have tried srttotime, etc. to no avail.

php-dev Solved
AD
asked 5 months ago by Adamski
0 votes
2 ans
34 views
How to remove the leading character from a string?

I have a input string like: $str = ':this is a applepie :) '; How can I remove the first occurring `:` with PHP? Desired output: `this is a...

php-dev Solved
YU
asked 5 months ago by yuli chika
0 votes
2 ans
29 views
Access first level keys with array_map() without calling `array_keys()`

Is there a way of doing something like this: $test_array = array( "first_key" => "first_value", "second_ke...

php-dev Solved
JO
asked 5 months ago by José Tomás Tocino
0 votes
2 ans
34 views
Truncate a string to first n characters of a string and add three dots if any characters are removed

How can I get the first n characters of a string in PHP? What's the fastest way to trim a string to a specific number of characters, and append '...&#39...

php-dev Solved
AL
asked 5 months ago by Alex
0 votes
2 ans
35 views
List of Big-O for PHP functions

After using PHP for a while now, I've noticed that not all built-in PHP functions are as fast as expected. Consider these two possible implementations of a...

php-dev Solved
KE
asked 5 months ago by Kendall Hopkins
0 votes
3 ans
32 views
How to get the last element of an array without deleting it?

Ok, I know all about [`array_pop()`][1], but that deletes the last element. How to get the last element of an array without deleting it? Here's a bon...

php-dev Solved
TH
asked 5 months ago by Theodore R. Smith