Tag: c

57 votes
29 answers
1.2K views
What does "use strict" do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error:

avatar
Ali
0 1 0 9
asked 07 September, 2021
56 votes
30 answers
2.5K views
How do I check if an element is hidden in jQuery?

Is it possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle()? How

avatar
Vi
0 1 0 9
asked 07 September, 2021
54 votes
30 answers
2.5K views
How can I remove a specific item from an array?

I have an array of numbers and I'm using the .push() method to add elements to it. Is there a simple way

avatar
Luis
0 1 0 9
asked 07 September, 2021
60 votes
17 answers
2.3K views
How do I implement basic "Long Polling"?

I can find lots of information on how Long Polling works (For example, this, and this), but no simple examples

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
67 votes
30 answers
2K views
How do I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a numb

avatar
Corrin
0 1 0 9
asked 07 September, 2021
59 votes
4 answers
1.7K views
What is thread safe or non-thread safe in PHP?

I saw different binaries for PHP, like non-thread or thread safe? What does this mean? What is the differen

avatar
Basil
0 1 0 9
asked 07 September, 2021
52 votes
17 answers
1.5K views
What is the difference between public, private, and protected?

When and why should I use public, private, and protected functions and variables inside a class? What is the d

avatar
Nidia
0 1 0 9
asked 07 September, 2021
65 votes
4 answers
1.8K views
What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?

I have tried reading some articles, but I am not very clear on the concepts yet. Would someone like to take a

avatar
Wei
0 1 0 9
asked 07 September, 2021
59 votes
17 answers
361 views
How do I expire a PHP session after 30 minutes?

I need to keep a session alive for 30 minutes and then destroy it.

avatar
Hildegard
0 1 0 9
asked 07 September, 2021
59 votes
17 answers
1.3K views
What is stdClass in PHP?

Please define what stdClass is.

avatar
Shantay
0 1 0 9
asked 07 September, 2021
55 votes
18 answers
3.1K views
How can I sanitize user input with PHP?

Is there a catchall function somewhere that works well for sanitizing user input for SQL injection and XSS att

avatar
Trudy
0 1 0 9
asked 07 September, 2021
62 votes
30 answers
724 views
Reference - What does this error mean in PHP?

What is this? This is a number of answers about warnings, errors, and notices you might encounter while progra

avatar
Frederick
0 1 0 9
asked 07 September, 2021
66 votes
14 answers
2.5K views
Secure hash and salt for PHP passwords

It is currently said that MD5 is partially unsafe. Taking this into consideration, I'd like to know which

avatar
User demo
0 1 0 9
asked 07 September, 2021
61 votes
16 answers
3K views
UTF-8 all the way through

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in

avatar
Keith
0 1 0 9
asked 07 September, 2021
52 votes
11 answers
2.1K views
How do you use bcrypt for hashing passwords in PHP?

Every now and then I hear the advice "Use bcrypt for storing passwords in PHP, bcrypt rules". But what is bcr

avatar
Alphonso
0 1 0 9
asked 07 September, 2021
60 votes
26 answers
2K views
Difference between require, include, require_once and include_once?

In PHP: When should I use require vs. include? When should I use require_once vs. include_once?

avatar
Deedee
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
2.2K views
How do I make a redirect in PHP?

Is it possible to redirect a user to a different page through the use of PHP? Say the user goes to www.exampl

avatar
Sachiko
0 1 0 9
asked 07 September, 2021
55 votes
23 answers
1.3K views
When should I use 'self' over '$this'?

In PHP 5, what is the difference between using self and $this? When is each appropriate?

avatar
Georgie
0 1 0 9
asked 07 September, 2021
69 votes
7 answers
1.9K views
How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how i

avatar
Leonardo
0 1 0 9
asked 07 September, 2021
58 votes
30 answers
2.9K views
How do I get a YouTube video thumbnail from the YouTube API?

If I have a YouTube video URL, is there any way to use PHP and cURL to get the associated thumbnail from the Y

avatar
Jesenia
0 1 0 9
asked 07 September, 2021