PHP code example of flsouto / mdx

1. Go to this page and download the library: Download flsouto/mdx library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flsouto / mdx example snippets




	// Contents of my_library.php
	function extractWords($input){
		return explode(' ', $input);
	}

	// Contents of tests.php
	

		function testCase1(){
		#mdx:snippet1
		$string = "Input to be tested";
		$words = extractWords($string);
		#/mdx
		assert(count($words)==4);
	}


		
		$string = "Input to be tested";
		$words = extractWords($string);		
		

		function testCase1(){
		#mdx:snippet1
		$string = "Input to be tested";
		$words = extractWords($string);
		#/mdx print_r($words)
		assert(count($words)==4);
	}


		
		$string = "Input to be tested";
		$words = extractWords($string);
		print_r($words)
		

		function testCase1(){
		#mdx:snippet1
		$string = "Input to be tested";
		#mdx:o var_dump($string)
		$words = extractWords($string);
		#/mdx
		assert(count($words)==4);
	}


		
	some_dev_stuff(); #mdx:skip
	
	// etc...


#mdx:h autoload
se Some\Library as Alias;

// etc...

#mdx:h autoload hidden

alias mdx='php /path/to/flsouto/mdx/process.php'

mdx README.mdx tests.php > README.md

mdx README.mdx tests.php > README.md

#mdx:snippet1 -php

#mdx:snippet1 -php -h:alias

See this example:
#mdx:snippet1 -php -h:alias,autoload

See another example:
#mdx:snippet2 -php -h:alias,autoload

See yet another example:
#mdx:snippet3 -php -h:alias,autoload