Tutorial by Examples

The if statement in the example above allows to execute a code fragment, when the condition is met. When you want to execute a code fragment, when the condition is not met you extend the if with an else. if ($a > $b) { echo "a is greater than b"; } else { echo "a is NOT gre...
require require is similar to include, except that it will produce a fatal E_COMPILE_ERROR level error on failure. When the require fails, it will halt the script. When the include fails, it will not halt the script and only emit E_WARNING. require 'file.php'; PHP Manual - Control Structures - ...
The return statement returns the program control to the calling function. When return is called from within a function, the execution of the current function will end. function returnEndsFunctions() { echo 'This is executed'; return; echo 'This is not executed.'; } When you run re...

for

for loops are typically used when you have a piece of code which you want to repeat a given number of times. for ($i = 1; $i < 10; $i++) { echo $i; } Outputs: 123456789 For detailed information, see the Loops topic.
foreach is a construct, which enables you to iterate over arrays and objects easily. $array = [1, 2, 3]; foreach ($array as $value) { echo $value; } Outputs: 123. To use foreach loop with an object, it has to implement Iterator interface. When you iterate over associative arrays: $arra...
elseif elseif combines if and else. The if statement is extended to execute a different statement in case the original if expression is not met. But, the alternative expression is only executed, when the elseif conditional expression is met. The following code displays either "a is bigger tha...

if

The if construct allows for conditional execution of code fragments. if ($a > $b) { echo "a is bigger than b"; } PHP Manual - Control Structures - If
In this example we show how to generate a simple sine wave, and output it on the user's speakers/headphones. let audioContext = new (window.AudioContext || window.webkitAudioContext)(); let sourceNode = audioContext.createOscillator(); sourceNode.type = 'sine'; sourceNode.frequency.value = 261...
Effects can be applied to audio by chaining nodes between the source and the destination node. In this example we use a gain node to mute the source, and only let sound through at specific times. This allows us to create morse code. function morse(gainNode, pattern) { let silenceTimeout = 300; ...
Assuming we want to modify bit n of an integer primitive, i (byte, short, char, int, or long): (i & 1 << n) != 0 // checks bit 'n' i |= 1 << n; // sets bit 'n' to 1 i &= ~(1 << n); // sets bit 'n' to 0 i ^= 1 << n; // toggles the value of bit 'n' Us...
You must be very careful when providing a forwarding reference overload as it may match too well: struct A { A() = default; // #1 A(A const& ) = default; // #2 template <class T> A(T&& ); // #3 }; The intent here was that A is c...
Pointers can also be used to point at functions. Let's take a basic function: int my_function(int a, int b) { return 2 * a + 3 * b; } Now, let's define a pointer of that function's type: int (*my_pointer)(int, int); To create one, just use this template: return_type_of_func (*my_fun...
In addition to the default set of directives shipped in core, Vue.js also allows you to register custom directives. Custom directives provide a mechanism for mapping data changes to arbitrary DOM behavior. You can register a global custom directive with the Vue.directive(id, definition) method, pas...
In Index page change the following: error_reporting(E_ALL | E_STRICT); to error_reporting(E_ALL); Set $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true and uncomment this line (remove the #) #ini_set('display_errors', 1); You can also Set Dev Mode using SetEnv in your .htaccess file To make th...
Creating and returning an image object by loading the image data from the file at the specified path. Example: UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[cellCountry objectForKey:@"Country_Flag"] ofType:nil]]; Using Array: Example NSM...
Template <div id="example"> a={{ a }}, b={{ b }} </div> JavaScript var vm = new Vue({ el: '#example', data: { a: 1 }, computed: { // a computed getter b: function () { // `this` points to the vm instance return this.a + 1 }...
The general format for namespaces is: <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]. Examples include: Fabrikam.Math Litware.Security Prefixing namespace names with a company name prevents namespaces from different companies from having the sa...
Objective-C //set off-image mySwitch.offImage = [UIImage imageNamed:@"off_image"]; [mySwitch setOffImage:[UIImage imageNamed:@"off_image"]]; //set on-image mySwitch.onImage = [UIImage imageNamed:@"on_image"]; [mySwitch setOnImage:[UIImage imageNamed:@"on_im...
# Extract strings with a specific regex df= df['col_name'].str.extract[r'[Aa-Zz]'] # Replace strings within a regex df['col_name'].str.replace('Replace this', 'With this') For information on how to match strings using regex, see Getting started with Regular Expressions.
The minimum required to use Webpack is the following command: webpack ./src/index.js ./dist/bundle.js // this is equivalent to: webpack source-file destination-file Web pack will take the source file, compile to the output destination and resolve any dependencies in the source files.

Page 293 of 1336