PhP

Showing 1 to 6 of 25 posts.

Get methods of an object PHP

Posted on September 22nd, 2019 in PhP by George

 

Easy way to inspect the available methods of an object in PHP by using get_class and get_class_methods built-in functions.

 

Read more...

Reflection api example, inheritance and how to inspect private methods

Posted on October 21st, 2018 in PhP by George


Here is an example of PHP Reflection api and class inheritance. This example will cover a lot of things like getDocComment() method of reflection api and insanceof plus other things. In order to make sense of the code read the comments. Caveats: getDocComment will return only comments declared on the global scope of the namesapce/document in case. The comment must start in this form with double asterix /** and end */; 

Read more...

php Overloading example

Posted on October 3rd, 2018 in PhP by George

Example of Overloading in PHP.

Read more...

Singleton class in PhP? The 'why' and 'how'.

Posted on October 2nd, 2018 in PhP by George

 

PHP Singleton example, the structure and practical example. Useful in order to restrict the number of instances. Estabilishing a connection with a database it is time consuming. Here Singleton can help by providing the same open connection when required instean of instantiating a new one.

Read more...

How many data types has PHP? PhP vs Javascript primitive data types.

Posted on September 28th, 2018 in PhP by George

You can not be a programmer without properly understandig the data types of the program language you are using. Today we going to talk about data types in PhP and Javascript, enumerate all of them and add a short description/comment for each.

Read more...

PHP casting and JavaScript coercion

Posted on September 28th, 2018 in PhP, JavaScript by George

PHP and JavaScript do not require explicit type definiton whenever you are creating a variable.The variable type is going to be defined by the context in wich the variable is assigned.Converting a data type using an explicit method it is called casting while converting a data type using an implicit (forced way) it called coercion. But what is PHP casting and what is JavaScript coercion? Are they alike? or are they different ? Read the article to find out what casting and coercion are and the syntax for each of the two languages.

 

Read more...

Categories